|
|
@@ -5,12 +5,13 @@
|
|
|
</template>
|
|
|
<Form ref="formRef" class="g-form__container" @submit="onSubmit">
|
|
|
<CellGroup inset>
|
|
|
- <Field v-model="formData.OldPwd" type="password" name="OldPwd" :label="$t('user.password.oldpwd')" :placeholder="$t('common.required')"
|
|
|
- autocomplete="off" :rules="formRules.OldPwd" />
|
|
|
- <Field v-model="formData.NewPwd" name="NewPwd" type="password" :label="$t('user.password.newpwd')" :placeholder="$t('common.required')"
|
|
|
- autocomplete="off" :rules="formRules.NewPwd" />
|
|
|
- <Field v-model="confirmpassword" name="confirmpassword" type="password" :label="$t('user.password.confirmpwd')" :placeholder="$t('common.required')"
|
|
|
- autocomplete="off" :rules="formRules.confirmpassword" />
|
|
|
+ <Field v-model="formData.OldPwd" type="password" name="OldPwd" :label="$t('user.password.oldpwd')"
|
|
|
+ :placeholder="$t('common.required')" autocomplete="off" :rules="formRules.OldPwd" />
|
|
|
+ <Field v-model="formData.NewPwd" name="NewPwd" type="password" :label="$t('user.password.newpwd')"
|
|
|
+ :placeholder="$t('common.required')" autocomplete="off" :rules="formRules.NewPwd" />
|
|
|
+ <Field v-model="confirmpassword" name="confirmpassword" type="password"
|
|
|
+ :label="$t('user.password.confirmpwd')" :placeholder="$t('common.required')" autocomplete="off"
|
|
|
+ :rules="formRules.confirmpassword" />
|
|
|
</CellGroup>
|
|
|
</Form>
|
|
|
<template #footer>
|
|
|
@@ -31,7 +32,7 @@ import { validateRules } from '@/constants/regex'
|
|
|
import { useAccountPassword } from '@/business/user'
|
|
|
import { useLogin } from '@/business/login'
|
|
|
import eventBus from '@/services/bus'
|
|
|
-import { i18n } from '@/stores'
|
|
|
+import { useGlobalStore, i18n } from '@/stores'
|
|
|
|
|
|
const { getGlobalUrlParams } = useNavigation()
|
|
|
const { userLogout } = useLogin()
|
|
|
@@ -40,6 +41,7 @@ const formRef = shallowRef<FormInstance>()
|
|
|
const confirmpassword = shallowRef('')
|
|
|
|
|
|
const { global: { t } } = i18n
|
|
|
+const globalStore = useGlobalStore()
|
|
|
|
|
|
// 表单验证规则
|
|
|
const formRules: { [key: string]: FieldRule[] } = {
|
|
|
@@ -51,10 +53,13 @@ const formRules: { [key: string]: FieldRule[] } = {
|
|
|
required: true,
|
|
|
message: t('user.password.tips2'),
|
|
|
validator: (val) => {
|
|
|
- if (validateRules.password.validate(val)) {
|
|
|
- return true
|
|
|
+ if (globalStore.getSystemInfo('strongPassword')) {
|
|
|
+ if (validateRules.password.validate(val)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.password.message
|
|
|
}
|
|
|
- return validateRules.password.message
|
|
|
+ return val?.length < 6 ? '密码长度不能小于6位' : true
|
|
|
}
|
|
|
}],
|
|
|
confirmpassword: [{
|
|
|
@@ -84,7 +89,7 @@ const onSubmit = () => {
|
|
|
|
|
|
onBeforeRouteLeave((to, from, next) => {
|
|
|
const params = getGlobalUrlParams()
|
|
|
- if(params.forcedPasswordChange){
|
|
|
+ if (params.forcedPasswordChange) {
|
|
|
userLogout()
|
|
|
}
|
|
|
next()
|