mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-06 18:00:57 +00:00
fix: login page i18n same with personal settings
This commit is contained in:
@@ -37,7 +37,7 @@ def on_user_auth_login_success(sender, user, request, **kwargs):
|
||||
cache.set(lock_key, request.session.session_key, None)
|
||||
|
||||
lang = request.COOKIES.get('django_language')
|
||||
if not user.lang and lang:
|
||||
if lang:
|
||||
user.lang = lang
|
||||
|
||||
|
||||
|
@@ -294,6 +294,19 @@ class UserLoginGuardView(mixins.AuthMixin, RedirectView):
|
||||
)
|
||||
return url
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
from django.utils import timezone
|
||||
response = super().get(request, *args, **kwargs)
|
||||
try:
|
||||
response.set_cookie(
|
||||
settings.LANGUAGE_COOKIE_NAME,
|
||||
request.user.lang,
|
||||
expires=timezone.now() + timezone.timedelta(days=365)
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return response
|
||||
|
||||
|
||||
class UserLoginWaitConfirmView(TemplateView):
|
||||
template_name = 'authentication/login_wait_confirm.html'
|
||||
|
Reference in New Issue
Block a user