|
|
@ -31,6 +31,7 @@ |
|
|
|
export default Vue.extend({ |
|
|
|
export default Vue.extend({ |
|
|
|
name: 'security', |
|
|
|
name: 'security', |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
|
|
|
|
let that = this |
|
|
|
return { |
|
|
|
return { |
|
|
|
form: { |
|
|
|
form: { |
|
|
|
oldpwd: '', |
|
|
|
oldpwd: '', |
|
|
@ -52,13 +53,36 @@ |
|
|
|
message: this.$t('input_please', { keyword: this.$t('center.security.newpwd') }), |
|
|
|
message: this.$t('input_please', { keyword: this.$t('center.security.newpwd') }), |
|
|
|
trigger: 'blur' |
|
|
|
trigger: 'blur' |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
validator: (rule, value, callback) => { |
|
|
|
|
|
|
|
if (value === that.form.oldpwd) { |
|
|
|
|
|
|
|
callback(new Error(rule.msg.b)) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
callback() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
msg: { |
|
|
|
|
|
|
|
b: this.$t('center.security.tip.same_err') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
{ min: 3, max: 5, message: this.$t('center.security.rules.password', { min: 3, max: 5 }), trigger: 'blur' } |
|
|
|
{ min: 3, max: 5, message: this.$t('center.security.rules.password', { min: 3, max: 5 }), trigger: 'blur' } |
|
|
|
], |
|
|
|
], |
|
|
|
confirmpwd: [ |
|
|
|
confirmpwd: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
required: true, |
|
|
|
message: this.$t('input_confirm', { keyword: this.$t('center.security.newpwd') }), |
|
|
|
message: this.$t('input_confirm', { keyword: this.$t('center.security.newpwd') }), |
|
|
|
trigger: 'blur' |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
validator: (rule, value, callback) => { |
|
|
|
|
|
|
|
if (value !== that.form.newpwd) { |
|
|
|
|
|
|
|
callback(new Error(rule.msg.a)) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
callback() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
msg: { |
|
|
|
|
|
|
|
a: this.$t('account.form.tip.tow_diff') |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ min: 3, max: 5, message: this.$t('center.security.rules.password', { min: 3, max: 5 }), trigger: 'blur' } |
|
|
|
{ min: 3, max: 5, message: this.$t('center.security.rules.password', { min: 3, max: 5 }), trigger: 'blur' } |
|
|
|
] |
|
|
|
] |
|
|
@ -67,12 +91,31 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
onSubmit() { |
|
|
|
onSubmit() { |
|
|
|
|
|
|
|
let that=this |
|
|
|
this.$refs.form.validate((valid: boolean) => { |
|
|
|
this.$refs.form.validate((valid: boolean) => { |
|
|
|
if (valid) { |
|
|
|
if (valid) { |
|
|
|
this.$alert(this.$t('center.security.tip.ok').toString()) |
|
|
|
this.GLOBAL.fetchJSON('/v1/api/users/update','PUT',{ |
|
|
|
|
|
|
|
oldpwd:this.form.oldpwd, |
|
|
|
|
|
|
|
newpwd:this.form.newpwd |
|
|
|
|
|
|
|
},function(res) { |
|
|
|
|
|
|
|
if(res.code==='200'){ |
|
|
|
|
|
|
|
that.$message.info(that.$t('center.security.tip.ok').toString()) |
|
|
|
|
|
|
|
that.$cookies.remove(that.GLOBAL.user_key) |
|
|
|
|
|
|
|
that.$router.push(that.localePath('/account')) |
|
|
|
|
|
|
|
}else if(res.msg!==null){ |
|
|
|
|
|
|
|
that.$message.error(res.msg) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
that.$message.error(that.$t('center.security.tip.fail').toString()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log('error submit!!'); |
|
|
|
this.$message.error({ |
|
|
|
return false; |
|
|
|
message:this.$t('form_err').toString(), |
|
|
|
|
|
|
|
duration:2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|