mirror of https://github.com/jumpserver/jumpserver
perf: 优化登录前修改密码
parent
e3511df4f8
commit
5e5cd80bc2
|
@ -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)
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -31,7 +31,13 @@
|
|||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<a href="{{ redirect_url }}" class="btn btn-primary block full-width m-b">{% trans 'Return' %}</a>
|
||||
<a href="{{ redirect_url }}" class="btn btn-primary block full-width m-b">
|
||||
{% if confirm_button %}
|
||||
{{ confirm_button }}
|
||||
{% else %}
|
||||
{% trans 'Return' %}
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue