mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
perf: 第三方登录允许选择logo
This commit is contained in:
@@ -33,11 +33,11 @@
|
||||
"@aws-sdk/s3-request-presigner": "^3.535.0",
|
||||
"@certd/vue-js-cron-light": "^4.0.14",
|
||||
"@ctrl/tinycolor": "^4.1.0",
|
||||
"@fast-crud/editor-code": "^1.27.4",
|
||||
"@fast-crud/fast-crud": "^1.27.4",
|
||||
"@fast-crud/fast-extends": "^1.27.4",
|
||||
"@fast-crud/ui-antdv4": "^1.27.4",
|
||||
"@fast-crud/ui-interface": "^1.27.4",
|
||||
"@fast-crud/editor-code": "^1.27.6",
|
||||
"@fast-crud/fast-crud": "^1.27.6",
|
||||
"@fast-crud/fast-extends": "^1.27.6",
|
||||
"@fast-crud/ui-antdv4": "^1.27.6",
|
||||
"@fast-crud/ui-interface": "^1.27.6",
|
||||
"@iconify/tailwind": "^1.2.0",
|
||||
"@iconify/vue": "^4.1.1",
|
||||
"@manypkg/get-packages": "^2.2.2",
|
||||
|
||||
@@ -69,7 +69,7 @@ export function errorLog(error: any, notify = true) {
|
||||
* @description 创建一个错误
|
||||
*/
|
||||
export function errorCreate(msg: string, notify = true, data?: any) {
|
||||
const err = new CodeError(msg, data.code, data.data);
|
||||
const err = new CodeError(msg, data?.code || 1, data?.data);
|
||||
console.error("errorCreate", err);
|
||||
if (notify) {
|
||||
uiContext.get().notification.error({ message: err.message });
|
||||
|
||||
@@ -142,6 +142,7 @@ export const useUserStore = defineStore({
|
||||
url: provider.logoutUrl,
|
||||
method: "get",
|
||||
withCredentials: true,
|
||||
showErrorNotify: false,
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("注销第三方登录失败:", e);
|
||||
|
||||
@@ -278,7 +278,7 @@ export default defineComponent({
|
||||
//}
|
||||
|
||||
.fs-icon {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
// color: rgba(0, 0, 0, 0.45);
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import { computed, onMounted, ref } from "vue";
|
||||
import * as api from "./api";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const oauthProviderList = ref([]);
|
||||
const props = defineProps<{
|
||||
@@ -30,10 +31,13 @@ const computedTitle = computed(() => {
|
||||
});
|
||||
|
||||
const settingStore = useSettingStore();
|
||||
|
||||
const route = useRoute();
|
||||
const queryOauthOnly = route.query.oauthOnly as string;
|
||||
onMounted(async () => {
|
||||
oauthProviderList.value = await api.GetOauthProviders();
|
||||
//如果开启了自动跳转登录
|
||||
if (settingStore.sysPublic.oauthAutoRedirect) {
|
||||
if (settingStore.sysPublic.oauthAutoRedirect && queryOauthOnly !== "false") {
|
||||
const firstOauth = oauthProviderList.value.find(item => item.addonId > 0);
|
||||
if (firstOauth) {
|
||||
goOauthLogin(firstOauth.name);
|
||||
@@ -99,7 +103,7 @@ async function goOauthLogin(type: string) {
|
||||
border-radius: 100px;
|
||||
.fs-icon {
|
||||
font-size: 36px;
|
||||
color: #006be6 !important;
|
||||
color: #006be6;
|
||||
margin: 0px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ const onFinish = async (form: any) => {
|
||||
notification.success({
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
await loadOauthProviders();
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -255,6 +255,9 @@ export class ConnectController extends BaseController {
|
||||
if (logoutUrl){
|
||||
provider.logoutUrl = logoutUrl;
|
||||
}
|
||||
if(addon.icon){
|
||||
provider.icon = addon.icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
list.push(provider);
|
||||
|
||||
@@ -6,11 +6,21 @@ import { BuildLoginUrlReq, BuildLogoutUrlReq, IOauthProvider, OnCallbackReq } fr
|
||||
name: 'oidc',
|
||||
title: 'OIDC认证',
|
||||
desc: 'OpenID Connect 认证,统一认证服务',
|
||||
icon:"simple-icons:fusionauth",
|
||||
icon:"simple-icons:fusionauth:#006be6",
|
||||
showTest: false,
|
||||
})
|
||||
export class OidcOauthProvider extends BaseAddon implements IOauthProvider {
|
||||
|
||||
@AddonInput({
|
||||
title: "自定义图标",
|
||||
component: {
|
||||
name:"fs-icon-selector",
|
||||
vModel:"modelValue"
|
||||
},
|
||||
required: false,
|
||||
})
|
||||
icon = "";
|
||||
|
||||
@AddonInput({
|
||||
title: "ClientId",
|
||||
helper: "ClientId / appId",
|
||||
@@ -29,7 +39,7 @@ export class OidcOauthProvider extends BaseAddon implements IOauthProvider {
|
||||
|
||||
@AddonInput({
|
||||
title: "服务地址",
|
||||
helper: "Issuer地址,去掉/.well-known/openid-configuration的服务发现地址",
|
||||
helper: "Issuer地址,服务发现地址去掉/.well-known/openid-configuration",
|
||||
component: {
|
||||
placeholder: "https://oidc.example.com/oidc",
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BuildLoginUrlReq, BuildLogoutUrlReq, IOauthProvider, OnCallbackReq } fr
|
||||
name: 'wx',
|
||||
title: '微信登录',
|
||||
desc: '微信网站应用登录',
|
||||
icon: "mdi:wechat",
|
||||
icon: "ion:logo-wechat:green",
|
||||
showTest: false,
|
||||
})
|
||||
export class WxOauthProvider extends BaseAddon implements IOauthProvider {
|
||||
|
||||
Reference in New Issue
Block a user