mirror of
https://github.com/certd/certd.git
synced 2026-05-15 04:27:31 +08:00
feat: 彩虹登录支持选择多种登录方式
This commit is contained in:
@@ -114,7 +114,7 @@ export async function GetSmsTypeDefine(type: string) {
|
||||
|
||||
export async function GetOauthProviders() {
|
||||
return await request({
|
||||
url: "/oauth/providers",
|
||||
url: apiPrefix + "/oauth/providers",
|
||||
method: "post",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ const formState = reactive<Partial<SysSettings>>({
|
||||
const oauthProviders = ref([]);
|
||||
async function loadOauthProviders() {
|
||||
oauthProviders.value = await api.GetOauthProviders();
|
||||
mergeOauthProviderSettings();
|
||||
}
|
||||
|
||||
const bindDomain = computed(() => {
|
||||
@@ -164,6 +165,16 @@ const onFinish = async (form: any) => {
|
||||
function buildCallbackUrl(type: string) {
|
||||
return `${window.location.origin}/api/oauth/callback/${type}`;
|
||||
}
|
||||
|
||||
function mergeOauthProviderSettings() {
|
||||
const savedProviders = formState.public?.oauthProviders || {};
|
||||
for (const item of oauthProviders.value) {
|
||||
const saved = savedProviders[item.name];
|
||||
if (saved) {
|
||||
item.addonId = saved.addonId;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.sys-settings-oauth {
|
||||
|
||||
Reference in New Issue
Block a user