mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-16 15:28:38 +00:00
perf: 优化登录前修改密码
This commit is contained in:
@@ -277,7 +277,7 @@ class PasswdTooSimple(JMSException):
|
||||
|
||||
class PasswdNeedUpdate(JMSException):
|
||||
default_code = 'passwd_need_update'
|
||||
default_detail = _('The administrator require you to change your password this time')
|
||||
default_detail = _('You should to change your password before login')
|
||||
|
||||
def __init__(self, url, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@@ -233,7 +233,6 @@ class AuthMixin:
|
||||
)
|
||||
raise errors.PasswdNeedUpdate(url)
|
||||
|
||||
|
||||
@classmethod
|
||||
def _check_password_require_reset_or_not(cls, user: User):
|
||||
if user.password_has_expired:
|
||||
|
@@ -31,7 +31,8 @@ from ..forms import get_user_login_form_cls
|
||||
__all__ = [
|
||||
'UserLoginView', 'UserLogoutView',
|
||||
'UserLoginGuardView', 'UserLoginWaitConfirmView',
|
||||
'FlashPasswdTooSimpleMsgView', 'FlashPasswdHasExpiredMsgView', 'FlashPasswdNeedUpdateMsgView'
|
||||
'FlashPasswdTooSimpleMsgView', 'FlashPasswdHasExpiredMsgView',
|
||||
'FlashPasswdNeedUpdateMsgView'
|
||||
]
|
||||
|
||||
|
||||
@@ -218,7 +219,7 @@ class UserLogoutView(TemplateView):
|
||||
context = {
|
||||
'title': _('Logout success'),
|
||||
'messages': _('Logout success, return login page'),
|
||||
'interval': 1,
|
||||
'interval': 3,
|
||||
'redirect_url': reverse('authentication:login'),
|
||||
'auto_redirect': True,
|
||||
}
|
||||
@@ -234,7 +235,7 @@ class FlashPasswdTooSimpleMsgView(TemplateView):
|
||||
context = {
|
||||
'title': _('Please change your password'),
|
||||
'messages': _('Your password is too simple, please change it for security'),
|
||||
'interval': 5,
|
||||
'interval': 3,
|
||||
'redirect_url': request.GET.get('redirect_url'),
|
||||
'auto_redirect': True,
|
||||
}
|
||||
@@ -248,10 +249,11 @@ class FlashPasswdNeedUpdateMsgView(TemplateView):
|
||||
def get(self, request, *args, **kwargs):
|
||||
context = {
|
||||
'title': _('Please change your password'),
|
||||
'messages': _('The administrator require you to change your password this time'),
|
||||
'interval': 8,
|
||||
'messages': _('You should to change your password before login'),
|
||||
'interval': 3,
|
||||
'redirect_url': request.GET.get('redirect_url'),
|
||||
'auto_redirect': True,
|
||||
'confirm_button': _('Confirm')
|
||||
}
|
||||
return self.render_to_response(context)
|
||||
|
||||
@@ -264,8 +266,9 @@ class FlashPasswdHasExpiredMsgView(TemplateView):
|
||||
context = {
|
||||
'title': _('Please change your password'),
|
||||
'messages': _('Your password has expired, please reset before logging in'),
|
||||
'interval': 5,
|
||||
'interval': 3,
|
||||
'redirect_url': request.GET.get('redirect_url'),
|
||||
'auto_redirect': True,
|
||||
'confirm_button': _('Confirm')
|
||||
}
|
||||
return self.render_to_response(context)
|
||||
|
Reference in New Issue
Block a user