mirror of https://github.com/halo-dev/halo-admin
fix: mfa login. (#276)
parent
8f70ffa5ab
commit
418f0e13ff
|
@ -68,7 +68,7 @@
|
||||||
:loading="form.logging"
|
:loading="form.logging"
|
||||||
type="primary"
|
type="primary"
|
||||||
:block="true"
|
:block="true"
|
||||||
@click="handleLoginClick"
|
@click="form.needAuthCode ? handleLogin() : handleLoginClick()"
|
||||||
>{{ buttonName }}</a-button>
|
>{{ buttonName }}</a-button>
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
</a-form-model>
|
</a-form-model>
|
||||||
|
@ -92,22 +92,22 @@ export default {
|
||||||
model: {
|
model: {
|
||||||
authcode: null,
|
authcode: null,
|
||||||
password: null,
|
password: null,
|
||||||
username: null
|
username: null,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
username: [{ required: true, message: '* 用户名/邮箱不能为空', trigger: ['change'] }],
|
username: [{ required: true, message: '* 用户名/邮箱不能为空', trigger: ['change'] }],
|
||||||
password: [{ required: true, message: '* 密码不能为空', trigger: ['change'] }],
|
password: [{ required: true, message: '* 密码不能为空', trigger: ['change'] }],
|
||||||
authcode: [{ validator: authcodeValidate, trigger: ['change'] }]
|
authcode: [{ validator: authcodeValidate, trigger: ['change'] }],
|
||||||
},
|
},
|
||||||
needAuthCode: false,
|
needAuthCode: false,
|
||||||
logging: false
|
logging: false,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
buttonName() {
|
buttonName() {
|
||||||
return this.form.needAuthCode ? '验证' : '登录'
|
return this.form.needAuthCode ? '验证' : '登录'
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['login', 'refreshUserCache', 'refreshOptionsCache']),
|
...mapActions(['login', 'refreshUserCache', 'refreshOptionsCache']),
|
||||||
|
@ -116,9 +116,6 @@ export default {
|
||||||
_this.$refs.loginForm.validate((valid) => {
|
_this.$refs.loginForm.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
_this.form.logging = true
|
_this.form.logging = true
|
||||||
if (_this.form.needAuthCode && _this.form.model.authcode) {
|
|
||||||
_this.handleLogin()
|
|
||||||
} else {
|
|
||||||
adminApi
|
adminApi
|
||||||
.loginPreCheck(_this.form.model.username, _this.form.model.password)
|
.loginPreCheck(_this.form.model.username, _this.form.model.password)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -136,7 +133,6 @@ export default {
|
||||||
}, 300)
|
}, 300)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleLogin() {
|
handleLogin() {
|
||||||
|
@ -156,7 +152,7 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue