-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(website): Restrict unhealthy application selection during websit… #8269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,7 +181,7 @@ import { useRouter } from 'vue-router'; | |
| import type { ElForm } from 'element-plus'; | ||
| import { loginApi, getCaptcha, mfaLoginApi, getLoginSetting } from '@/api/modules/auth'; | ||
| import { GlobalStore, MenuStore, TabsStore } from '@/store'; | ||
| import { MsgSuccess } from '@/utils/message'; | ||
| import { MsgError, MsgSuccess } from '@/utils/message'; | ||
| import { useI18n } from 'vue-i18n'; | ||
| import { encryptPassword } from '@/utils/util'; | ||
| import { getXpackSettingForTheme } from '@/utils/xpack'; | ||
|
|
@@ -338,6 +338,7 @@ const login = (formEl: FormInstance | undefined) => { | |
| tabsStore.removeAllTabs(); | ||
| globalStore.currentNode = 'local'; | ||
| MsgSuccess(i18n.t('commons.msg.loginSuccess')); | ||
| console.log('loiin syc'); | ||
| router.push({ name: 'home' }); | ||
| document.onkeydown = null; | ||
| } catch (res) { | ||
|
|
@@ -346,12 +347,15 @@ const login = (formEl: FormInstance | undefined) => { | |
| loginForm.captcha = ''; | ||
| errCaptcha.value = true; | ||
| errAuthInfo.value = false; | ||
| return; | ||
| } | ||
| if (res.message === 'ErrAuth') { | ||
| globalStore.ignoreCaptcha = false; | ||
| errCaptcha.value = false; | ||
| errAuthInfo.value = true; | ||
| return; | ||
| } | ||
| MsgError(res.message); | ||
| } | ||
| loginVerify(); | ||
| } finally { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code provided has several minor changes and suggestions to improve it:
Here's the optimized version of the code: const login = async (formEl: FormInstance | undefined) => {
if (!formEl)
return;
await formEl.validate((valid) => {
if (valid) {
try {
await loginApi({
username: loginForm.username,
password: encryptedPassword(loginForm.password),
// Add other necessary parameters here if required
});
tabsStore.removeAllTabs();
globalStore.currentNode = 'local';
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
router.push({ name: 'home' });
document.onkeydown = null;
} catch (res) {
if (res.message === 'ErrCaptcha') {
loginForm.captcha = '';
errCaptcha.value = true;
errAuthInfo.value = false;
return;
}
if (res.message === 'ErrAuth' || res.message.includes("error occurred")) {
globalStore.ignoreCaptcha = false;
errCaptcha.value = false;
errAuthInfo.value = true;
return;
}
MsgError(res.message);
}
loginVerify();
}
});
};Key Changes and Suggestions:
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,13 +107,19 @@ | |
| :label="$t('website.appInstalled')" | ||
| prop="appInstallId" | ||
| > | ||
| <el-select v-model="website.appInstallId" class="p-w-200"> | ||
| <el-select v-model="website.appInstallId" class="p-w-300"> | ||
| <el-option | ||
| v-for="(appInstall, index) in appInstalls" | ||
| :key="index" | ||
| :label="appInstall.name" | ||
| :value="appInstall.id" | ||
| ></el-option> | ||
| :disabled="appInstall.status !== 'Running'" | ||
| > | ||
| <div class="flex justify-between items-center w-full"> | ||
| <span>{{ appInstall.name }}</span> | ||
| <span><Status :key="appInstall.status" :status="appInstall.status"></Status></span> | ||
| </div> | ||
| </el-option> | ||
| </el-select> | ||
| </el-form-item> | ||
| <div v-if="website.appType == 'new'"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the provided code change, it has been updated to make the OptimizationSuggestions:
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be an issue with the
SaveLoginLogsfunction call. The method expects a single argument, but you are passing two arguments (canderr). You should modify it to correctly pass just the one required parameter.Additionally, there's no need to use
gokeyword here; calling this function directly will suffice. Here is the corrected line:Here's the updated Go function:
This ensures that the function
saveLoginLogsreceives only the necessary parameter.