|
@@ -158,14 +158,34 @@ const handleLogin = () => {
|
|
|
userStore.setUsername(res.data.uname || '')
|
|
userStore.setUsername(res.data.uname || '')
|
|
|
router.push('/')
|
|
router.push('/')
|
|
|
} else if (res.code === 400) {
|
|
} else if (res.code === 400) {
|
|
|
|
|
+ const { data } = res
|
|
|
// 验证码错误
|
|
// 验证码错误
|
|
|
- if (res.data.msg === 'password_error') {
|
|
|
|
|
|
|
+ if (data.msg === 'password_error') {
|
|
|
loginError.value.password = true
|
|
loginError.value.password = true
|
|
|
- } else if (res.data.msg === 'verifcation_error') {
|
|
|
|
|
|
|
+ } else if (data.msg === 'verifcation_error') {
|
|
|
loginError.value.code = true
|
|
loginError.value.code = true
|
|
|
- } else if (res.data.msg === 'error_times') {
|
|
|
|
|
|
|
+ } else if (data.msg === 'error_times') {
|
|
|
errorTipsRef.value.openDialog()
|
|
errorTipsRef.value.openDialog()
|
|
|
}
|
|
}
|
|
|
|
|
+ } else if (res.code === 500) {
|
|
|
|
|
+ const { data } = res
|
|
|
|
|
+ if (data.msg === 'passwordExpires') {
|
|
|
|
|
+ ElMessageBox.alert('Password expired, please change your password', 'Prompt', {
|
|
|
|
|
+ confirmButtonText: 'OK',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ confirmButtonClass: 'el-button--dark'
|
|
|
|
|
+ })
|
|
|
|
|
+ userStore.setUsername(res.data.uname || '')
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ name: 'Reset Password'
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessageBox.alert(data.desc, {
|
|
|
|
|
+ confirmButtonText: 'OK',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ confirmButtonClass: 'el-button--dark'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.finally(() => {
|
|
.finally(() => {
|