From 8b058a873e3b3d65dd86f4b28628b3d7bc737774 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 20 Mar 2023 19:26:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=99=BB=E5=BD=95=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E8=BD=AF=E4=BB=B6=E8=AE=B8=E5=8F=AF=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E5=90=8C=E6=84=8F=E9=80=89=E9=A1=B9=20(#322)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/modules/en.ts | 3 +++ frontend/src/lang/modules/zh.ts | 3 +++ frontend/src/store/index.ts | 4 +++ frontend/src/store/interface/index.ts | 1 + .../src/views/login/components/login-form.vue | 26 +++++++++++++++++++ 5 files changed, 37 insertions(+) diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 9ef9902ae..d306a2df3 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -121,6 +121,9 @@ const message = { 'Note: [Closing the security entrance] will make your panel login address directly exposed to the Internet, very dangerous, please exercise caution', codeInput: 'Please enter the 6-digit verification code of the MFA validator', title: 'Linux Server Management Panel', + licenseHelper: + 'Agree to FIT2CLOUD « Community Software License Agreement »', + errorAgree: 'Please click to agree to the Community Software License Agreement', }, rule: { username: 'Please enter a username', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index df58f0d33..d4ac52dc7 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -125,6 +125,9 @@ const message = { codeInput: '请输入 MFA 验证器的 6 位验证码', mfaTitle: 'MFA认证', title: 'Linux 服务器运维管理面板', + licenseHelper: + '同意 FIT2CLOUD 飞致云 « 社区软件许可协议 »', + errorAgree: '请点击同意社区软件许可协议', }, rule: { username: '请输入用户名', diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.ts index d4d480d36..d1a47e83e 100644 --- a/frontend/src/store/index.ts +++ b/frontend/src/store/index.ts @@ -20,6 +20,7 @@ export const GlobalStore = defineStore({ footer: true, }, isFullScreen: false, + agreeLicense: false, }), getters: {}, actions: { @@ -45,6 +46,9 @@ export const GlobalStore = defineStore({ setThemeConfig(themeConfig: ThemeConfigProp) { this.themeConfig = themeConfig; }, + setAgreeLicense(agree: boolean) { + this.agreeLicense = agree; + }, }, persist: piniaPersistConfig('GlobalState'), }); diff --git a/frontend/src/store/interface/index.ts b/frontend/src/store/interface/index.ts index 6edd1ae1b..55cb4b0e2 100644 --- a/frontend/src/store/interface/index.ts +++ b/frontend/src/store/interface/index.ts @@ -16,6 +16,7 @@ export interface GlobalState { // assemblySize: string; // small | default | large themeConfig: ThemeConfigProp; isFullScreen: boolean; + agreeLicense: boolean; } export interface MenuState { diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue index dc1b47200..4d067457e 100644 --- a/frontend/src/views/login/components/login-form.vue +++ b/frontend/src/views/login/components/login-form.vue @@ -157,6 +157,20 @@ {{ $t('commons.button.login') }} + + + + + + {{ $t('commons.login.errorAgree') }} + +
@@ -186,6 +200,7 @@ const errAuthInfo = ref(false); const errCaptcha = ref(false); const errMfaInfo = ref(false); const isDemo = ref(false); +const errAgree = ref(false); const isFirst = ref(); @@ -212,6 +227,7 @@ const loginForm = reactive({ captcha: '', captchaID: '', authMethod: '', + agreeLicense: false, }); const loginRules = reactive({ name: [{ required: true, message: i18n.global.t('commons.rule.username'), trigger: 'blur' }], @@ -259,6 +275,14 @@ const login = (formEl: FormInstance | undefined) => { captchaID: captcha.captchaID, authMethod: '', }; + if (requestLoginForm.captcha == '') { + errCaptcha.value = true; + return; + } + if (loginForm.agreeLicense == false) { + errAgree.value = true; + return; + } const res = await loginApi(requestLoginForm); if (res.code === 406) { if (res.message === 'ErrCaptchaCode') { @@ -280,6 +304,7 @@ const login = (formEl: FormInstance | undefined) => { return; } globalStore.setLogStatus(true); + globalStore.setAgreeLicense(true); menuStore.setMenuList([]); MsgSuccess(i18n.global.t('commons.msg.loginSuccess')); router.push({ name: 'home' }); @@ -335,6 +360,7 @@ function checkPassword(rule: any, value: any, callback: any) { onMounted(() => { document.title = globalStore.themeConfig.panelName; + loginForm.agreeLicense = globalStore.agreeLicense; checkStatus(); checkIsSystemDemo(); document.onkeydown = (e: any) => {