[Update] 修改忘记密码页面的错误信息提示

pull/3907/head
Bai 5 years ago
parent 6a2a0013a8
commit 6890d549ed

@ -43,11 +43,13 @@ class UserForgotPasswordView(FormView):
user = get_object_or_none(User, email=email) user = get_object_or_none(User, email=email)
if not user: if not user:
error = _('Email address invalid, please input again') error = _('Email address invalid, please input again')
return self.get(request, errors=error) form.add_error('email', error)
return self.form_invalid(form)
elif not user.can_update_password(): elif not user.can_update_password():
error = _('User auth from {}, go there change password'.format( error = _('User auth from {}, go there change password'.format(
user.source)) user.source))
return self.get(request, errors=error) form.add_error('email', error)
return self.form_invalid(form)
else: else:
send_reset_password_mail(user) send_reset_password_mail(user)
return redirect('users:forgot-password-sendmail-success') return redirect('users:forgot-password-sendmail-success')

Loading…
Cancel
Save