添加md5密码加密

This commit is contained in:
熊丽君
2021-10-13 14:34:49 +08:00
parent 850f79b91f
commit 1c7b1df588
2 changed files with 8 additions and 4 deletions

View File

@ -173,11 +173,14 @@ export default {
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
if (valid) { if (valid) {
let form = Object.assign({}, this.form);
if (this.title == '修改密码') { if (this.title == '修改密码') {
if (this.form.password !== this.password) if (form.password !== this.password)
return this.msgError('新旧密码不一致'); return this.msgError('新旧密码不一致');
form.password = this.md5(form.password);
form.oldPassword = this.md5(form.oldPassword);
} }
updateInfo(this.form).then(({ message }) => { updateInfo(form).then(({ message }) => {
this.msgSuccess(message); this.msgSuccess(message);
// store.commit('SET_NAME', this.form.username); // store.commit('SET_NAME', this.form.username);
// this.dialogVisible = false; // this.dialogVisible = false;

View File

@ -434,9 +434,10 @@ export default {
Cookies.remove('rememberMe'); Cookies.remove('rememberMe');
} }
if (this.mode) { if (this.mode) {
console.log(this.md5(this.loginForm.password)); let loginForm = Object.assign({}, this.loginForm);
loginForm.password = this.md5(loginForm.password);
this.$store this.$store
.dispatch('Login', this.loginForm) .dispatch('Login', loginForm)
.then(() => { .then(() => {
// this.$router.go(-1); // this.$router.go(-1);
this.$router.push({ path: this.redirect || '/' }); this.$router.push({ path: this.redirect || '/' });