mirror of
https://github.com/jumpserver/lina.git
synced 2025-10-22 08:08:39 +00:00
perf: 优化登录前更新密码
This commit is contained in:
@@ -27,8 +27,8 @@ export default {
|
||||
fields: [
|
||||
[this.$t('users.Account'), ['name', 'username', 'email', 'groups']],
|
||||
[this.$t('users.Authentication'), [
|
||||
'password_strategy', 'update_password', 'password', 'set_public_key',
|
||||
'public_key', 'mfa_level', 'source', 'need_update_password'
|
||||
'password_strategy', 'update_password', 'password', 'need_update_password',
|
||||
'set_public_key', 'public_key', 'mfa_level', 'source'
|
||||
]],
|
||||
[this.$t('users.Secure'), ['role', 'org_roles', 'date_expired']],
|
||||
[this.$t('common.Other'), ['phone', 'wechat', 'comment']]
|
||||
@@ -46,13 +46,6 @@ export default {
|
||||
rules.Required
|
||||
]
|
||||
},
|
||||
need_update_password: {
|
||||
label: this.$t('users.isUpdatePassword'),
|
||||
type: 'checkbox',
|
||||
hidden: (formValue) => {
|
||||
return formValue.source !== 'local'
|
||||
}
|
||||
},
|
||||
update_password: {
|
||||
label: this.$t('users.UpdatePassword'),
|
||||
type: 'checkbox',
|
||||
@@ -69,12 +62,31 @@ export default {
|
||||
if (formValue.password_strategy) {
|
||||
return false
|
||||
}
|
||||
return !formValue.update_password || !formValue.can_public_key_auth
|
||||
return !formValue.update_password || !this.user.can_public_key_auth
|
||||
},
|
||||
el: {
|
||||
required: false
|
||||
}
|
||||
},
|
||||
need_update_password: {
|
||||
label: '',
|
||||
type: 'checkbox-group',
|
||||
el: {
|
||||
style: 'margin-top: -20px;margin-bottom: -10px'
|
||||
},
|
||||
options: [
|
||||
{
|
||||
label: true,
|
||||
value: this.$t('users.needUpdatePasswordNextLogin')
|
||||
}
|
||||
],
|
||||
hidden: (formValue) => {
|
||||
if (formValue.password_strategy) {
|
||||
return false
|
||||
}
|
||||
return !formValue.update_password || !this.user.can_public_key_auth
|
||||
}
|
||||
},
|
||||
set_public_key: {
|
||||
label: this.$t('users.SetPublicKey'),
|
||||
type: 'checkbox',
|
||||
@@ -82,7 +94,7 @@ export default {
|
||||
if (formValue.set_public_key) {
|
||||
return true
|
||||
}
|
||||
return this.$route.meta.action !== 'update' || !this.user.can_public_key_auth
|
||||
return this.$route.meta.action !== 'update'
|
||||
}
|
||||
},
|
||||
public_key: {
|
||||
@@ -139,6 +151,9 @@ export default {
|
||||
if (method === 'post' && !value.password_strategy) {
|
||||
delete value['password']
|
||||
}
|
||||
if (value.update_password !== undefined) {
|
||||
delete value.update_password
|
||||
}
|
||||
return value
|
||||
},
|
||||
getMethod() {
|
||||
|
Reference in New Issue
Block a user