mirror of
https://github.com/certd/certd.git
synced 2026-04-22 10:57:25 +08:00
perf: 第三方登录允许选择logo
This commit is contained in:
@@ -65,6 +65,7 @@ export abstract class BaseAddon implements IAddon {
|
||||
http!: HttpClient;
|
||||
logger!: ILogger;
|
||||
|
||||
title!: string;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Generated
+25
-25
@@ -1080,20 +1080,20 @@ importers:
|
||||
specifier: ^4.1.0
|
||||
version: 4.1.0
|
||||
'@fast-crud/editor-code':
|
||||
specifier: ^1.27.4
|
||||
version: 1.27.4
|
||||
specifier: ^1.27.6
|
||||
version: 1.27.6
|
||||
'@fast-crud/fast-crud':
|
||||
specifier: ^1.27.4
|
||||
version: 1.27.4(vue@3.5.14(typescript@5.8.3))
|
||||
specifier: ^1.27.6
|
||||
version: 1.27.6(vue@3.5.14(typescript@5.8.3))
|
||||
'@fast-crud/fast-extends':
|
||||
specifier: ^1.27.4
|
||||
version: 1.27.4(aws-crt@1.26.2)(vue@3.5.14(typescript@5.8.3))
|
||||
specifier: ^1.27.6
|
||||
version: 1.27.6(aws-crt@1.26.2)(vue@3.5.14(typescript@5.8.3))
|
||||
'@fast-crud/ui-antdv4':
|
||||
specifier: ^1.27.4
|
||||
version: 1.27.4
|
||||
specifier: ^1.27.6
|
||||
version: 1.27.6
|
||||
'@fast-crud/ui-interface':
|
||||
specifier: ^1.27.4
|
||||
version: 1.27.4
|
||||
specifier: ^1.27.6
|
||||
version: 1.27.6
|
||||
'@iconify/tailwind':
|
||||
specifier: ^1.2.0
|
||||
version: 1.2.0
|
||||
@@ -3411,20 +3411,20 @@ packages:
|
||||
resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
|
||||
'@fast-crud/editor-code@1.27.4':
|
||||
resolution: {integrity: sha512-syuSxpNc/So5xoGGZkiC4Iqa8MdrQpeHJRqs6/A8pRUDh9UEN1iBFm8PPxmSluHc7sFXZdt0IIRfJE6sDBhRiA==}
|
||||
'@fast-crud/editor-code@1.27.6':
|
||||
resolution: {integrity: sha512-ynEfltaR11wVDwZjwMDlgKa7B/oudyEG5rgX8uUQbCcFb13tXArz/3KButB3+kaqQWK/jNakPhb/oM1lUkjv7g==}
|
||||
|
||||
'@fast-crud/fast-crud@1.27.4':
|
||||
resolution: {integrity: sha512-wwTqwETgcgBa8v2P/C2MGFfAxZGvAPDFiyrg3b9k+6eMePR//RbY9+M1knsTVaHTTkabAmgwZ+OnnCJzpmnK/A==}
|
||||
'@fast-crud/fast-crud@1.27.6':
|
||||
resolution: {integrity: sha512-V4sma2wWFLnivJT/vxEsSX5A80IRRppD6oSq935BlQ4a8tTuZ26QNNplmhL1L6Hp5NWDBDSxKfBIuJmTMBzm4A==}
|
||||
|
||||
'@fast-crud/fast-extends@1.27.4':
|
||||
resolution: {integrity: sha512-GVWmwondzouPsDD2mCLmxbR7RV5Cf1pJQS0nracQZfrwKsJdNcKlIZ3F3SULklAELMtW01hFbwt7VC+ZehjvAQ==}
|
||||
'@fast-crud/fast-extends@1.27.6':
|
||||
resolution: {integrity: sha512-85Eu7JuAQN9eRHi9vL9gunIApgayBrK9z6RIcPp0jY41nq5pKZA0DEQoU7jy1PL0bhvbtj9E22bDaA7rXqbTcw==}
|
||||
|
||||
'@fast-crud/ui-antdv4@1.27.4':
|
||||
resolution: {integrity: sha512-WcDYmlc06/BIpOnpfN7cZuWqW2kxZC5EfazVw1IaY+kxx3eLRdWX1dShh23oZEsKdwKwGcgY7xeiptFgEpel+Q==}
|
||||
'@fast-crud/ui-antdv4@1.27.6':
|
||||
resolution: {integrity: sha512-Eszzn6KgLy9TrjsJOfe3FFu2yMFF/oslCwiy8jknbuiZs/PUOhIhdQgQAn5hwmqTas/T62C/9pje5DVbgOUbNA==}
|
||||
|
||||
'@fast-crud/ui-interface@1.27.4':
|
||||
resolution: {integrity: sha512-hZJiABhXOZma6kaxes9waKMdVEjaEMUtEGZ7TIXXJuExynNOMK1AVtfgACSP5uwTj8mKxUEa7iBKx2vr9EcfFA==}
|
||||
'@fast-crud/ui-interface@1.27.6':
|
||||
resolution: {integrity: sha512-T6Fgwe1WUWoYMsK0uIZu4fbtaxN5IngUy/nikPREwHTePHS6br9vQTFefG8bZv5e+L381TIETXzfU70RoSJLGg==}
|
||||
|
||||
'@fidm/asn1@1.0.4':
|
||||
resolution: {integrity: sha512-esd1jyNvRb2HVaQGq2Gg8Z0kbQPXzV9Tq5Z14KNIov6KfFD6PTaRIO8UpcsYiTNzOqJpmyzWgVTrUwFV3UF4TQ==}
|
||||
@@ -15325,14 +15325,14 @@ snapshots:
|
||||
|
||||
'@eslint/js@8.57.0': {}
|
||||
|
||||
'@fast-crud/editor-code@1.27.4':
|
||||
'@fast-crud/editor-code@1.27.6':
|
||||
dependencies:
|
||||
js-yaml: 4.1.0
|
||||
lodash-es: 4.17.21
|
||||
monaco-editor: 0.52.2
|
||||
monaco-yaml: 5.4.0(monaco-editor@0.52.2)
|
||||
|
||||
'@fast-crud/fast-crud@1.27.4(vue@3.5.14(typescript@5.8.3))':
|
||||
'@fast-crud/fast-crud@1.27.6(vue@3.5.14(typescript@5.8.3))':
|
||||
dependencies:
|
||||
'@iconify/types': 2.0.0
|
||||
file-saver: 2.0.5
|
||||
@@ -15342,7 +15342,7 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- vue
|
||||
|
||||
'@fast-crud/fast-extends@1.27.4(aws-crt@1.26.2)(vue@3.5.14(typescript@5.8.3))':
|
||||
'@fast-crud/fast-extends@1.27.6(aws-crt@1.26.2)(vue@3.5.14(typescript@5.8.3))':
|
||||
dependencies:
|
||||
'@aws-sdk/client-s3': 3.810.0(aws-crt@1.26.2)
|
||||
'@aws-sdk/s3-request-presigner': 3.810.0
|
||||
@@ -15372,9 +15372,9 @@ snapshots:
|
||||
- utf-8-validate
|
||||
- vue
|
||||
|
||||
'@fast-crud/ui-antdv4@1.27.4': {}
|
||||
'@fast-crud/ui-antdv4@1.27.6': {}
|
||||
|
||||
'@fast-crud/ui-interface@1.27.4':
|
||||
'@fast-crud/ui-interface@1.27.6':
|
||||
dependencies:
|
||||
lodash-es: 4.17.21
|
||||
|
||||
|
||||
Reference in New Issue
Block a user