1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

fix: 密码修改禁止与初始密码一致

This commit is contained in:
ssongliu 2022-12-01 19:30:46 +08:00 committed by ssongliu
parent 99d329967c
commit cdf3f8cdd0
3 changed files with 8 additions and 4 deletions

View File

@ -115,12 +115,12 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.validate(async (valid) => {
if (!valid) return;
if (settingForm.complexityVerification === 'disable' && passForm.newPassword === passForm.oldPassword) {
let password =
settingForm.complexityVerification === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity;
if (password === passForm.oldPassword) {
ElMessage.error(i18n.global.t('setting.duplicatePassword'));
return;
}
let password =
settingForm.complexityVerification === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity;
await handleExpired({ oldPassword: passForm.oldPassword, newPassword: password });
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));
router.push({ name: 'home' });

View File

@ -116,7 +116,7 @@ const SaveSetting = async (formEl: FormInstance | undefined, key: string, val: a
}
let param = {
key: key,
value: val,
value: val + '',
};
await updateSetting(param);
ElMessage.success(i18n.t('commons.msg.operationSuccess'));

View File

@ -252,6 +252,10 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
form.settingInfo.complexityVerification === 'disable'
? passForm.newPassword
: passForm.newPasswordComplexity;
if (password === passForm.oldPassword) {
ElMessage.error(i18n.global.t('setting.duplicatePassword'));
return;
}
await updatePassword({ oldPassword: passForm.oldPassword, newPassword: password });
passwordVisiable.value = false;
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));