-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: Fix the problem of abnormal theme color switching #8012
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 |
|---|---|---|
|
|
@@ -184,6 +184,7 @@ import { MsgSuccess } from '@/utils/message'; | |
| import { useI18n } from 'vue-i18n'; | ||
| import { getSettingInfo } from '@/api/modules/setting'; | ||
| import { encryptPassword } from '@/utils/util'; | ||
| import { getXpackSettingForTheme } from '@/utils/xpack'; | ||
|
|
||
| const i18n = useI18n(); | ||
| const themeConfig = computed(() => globalStore.themeConfig); | ||
|
|
@@ -334,7 +335,6 @@ const login = (formEl: FormInstance | undefined) => { | |
| menuStore.setMenuList([]); | ||
| tabsStore.removeAllTabs(); | ||
| MsgSuccess(i18n.t('commons.msg.loginSuccess')); | ||
| loadDataFromDB(); | ||
| router.push({ name: 'home' }); | ||
| } catch (res) { | ||
| if (res.code === 401) { | ||
|
|
@@ -369,7 +369,6 @@ const mfaLogin = async (auto: boolean) => { | |
| menuStore.setMenuList([]); | ||
| tabsStore.removeAllTabs(); | ||
| MsgSuccess(i18n.t('commons.msg.loginSuccess')); | ||
| loadDataFromDB(); | ||
| router.push({ name: 'home' }); | ||
| } catch (res) { | ||
| if (res.code === 401) { | ||
|
|
@@ -415,6 +414,8 @@ const getSetting = async () => { | |
| onMounted(() => { | ||
| globalStore.isOnRestart = false; | ||
| getSetting(); | ||
| loadDataFromDB(); | ||
| getXpackSettingForTheme(); | ||
| if (!globalStore.ignoreCaptcha) { | ||
| loginVerify(); | ||
| } | ||
|
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 primary issue is that loading data from the database should be inside the loadData method rather than in the handleLogin event handler. This will ensure that user data isn't lost if it occurs before the Login component has displayed to the user. Here's a concise way of fixing this: Also, we could consider moving XPack setting retrieval into an isolated function within |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,14 +5,14 @@ | |
| <el-input type="password" show-password clearable v-model.trim="passForm.oldPassword" /> | ||
| </el-form-item> | ||
| <el-form-item | ||
| v-if="complexityVerification === 'disable'" | ||
| v-if="complexityVerification === 'Disable'" | ||
| :label="$t('setting.newPassword')" | ||
| prop="newPassword" | ||
| > | ||
| <el-input type="password" show-password clearable v-model.trim="passForm.newPassword" /> | ||
| </el-form-item> | ||
| <el-form-item | ||
| v-if="complexityVerification === 'enable'" | ||
| v-if="complexityVerification === 'Enable'" | ||
| :label="$t('setting.newPassword')" | ||
| prop="newPasswordComplexity" | ||
| > | ||
|
|
@@ -80,7 +80,7 @@ const acceptParams = (params: DialogProps): void => { | |
| }; | ||
|
|
||
| function checkPassword(rule: any, value: any, callback: any) { | ||
| let password = complexityVerification.value === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity; | ||
| let password = complexityVerification.value === 'Disable' ? passForm.newPassword : passForm.newPasswordComplexity; | ||
| if (password !== passForm.retryPassword) { | ||
| return callback(new Error(i18n.global.t('commons.rule.rePassword'))); | ||
| } | ||
|
|
@@ -92,7 +92,7 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => { | |
| formEl.validate(async (valid) => { | ||
| if (!valid) return; | ||
| let password = | ||
| complexityVerification.value === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity; | ||
| complexityVerification.value === 'Disable' ? passForm.newPassword : passForm.newPasswordComplexity; | ||
| if (password === passForm.oldPassword) { | ||
| MsgError(i18n.global.t('setting.duplicatePassword')); | ||
| return; | ||
|
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 provided code snippet appears to be related to creating an authentication form with password fields using El-Table component. I have not found specific differences between the two versions as they seem identical until version 80 ( if (password !== passForm.retryPassword)This seems problematic because it uses conditional expressions which can cause unexpected behavior due to its strict evaluation strategy. This is especially concerning considering the use case of a complex form validation system which would benefit from checking all conditions before applying the logic. A safer approach might involve removing or commenting out this line, ensuring both passwords match in each field. This will allow better error handling, maintainability, and security features during development and production scenarios by making the process more predictable. After reviewing other parts of the codebase, you should address any additional discrepancies if necessary within my capabilities to ensure compliance with coding standards and practices. I would appreciate further guidance on how to tackle this issue effectively without compromising on robust validation processes for user input data. |
||
|
|
||
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 doesn't seem to be any specific code differences that I can identify in the provided snippet of JavaScript. The changes appear minor and could be part of normal maintenance practices or bug fixes without any glaring issues.
However, it might be worth noting one small difference:
Could potentially have unintended side effects like calling
getMasterLicenseStatus()every time this file is loaded. To avoid those extra calls, maybe you should fetch the data once upon startup?As a general optimization strategy, consider creating more modular components or services and pass their initialization and retrieval parameters through these modules, making sure dependencies are satisfied only when required.
Regarding licensing statuses, there's no clear reference to licenses here. It would be important either to handle such situations at an API level before passing license details from Master Product Pro directly. Or to store relevant license info in some form within your current project structure, which makes sense considering the overall context of having multiple products licensed under different versions.
Keep in mind though, as this issue pertains solely to syntax/semantics modifications on existing pieces of code, it's not likely that it warrants further development efforts compared with other areas requiring enhancement or debugging efforts.
Since the focus seems to be on maintaining existing functionality instead of introducing new features, there isn't much scope for substantial improvements beyond suggested best practices or minor style adjustments. For detailed optimizations aimed at boosting performance or user experience, perhaps consult the documentation and/or seek external advice from experienced developers?