From ace028fa7f9c305398f923664bd0ed6af30478dc Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 27 Mar 2019 12:20:43 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E7=BB=9F=E4=B8=80=E5=8F=AF=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E7=9A=84interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/authentication}/login.html | 4 +-- .../templates/authentication}/login_otp.html | 4 +-- .../templates/authentication}/new_login.html | 32 ++++-------------- apps/authentication/views/login.py | 6 ++-- apps/jumpserver/context_processor.py | 14 +++++--- .../login_image_1.png => login_image.png} | Bin .../img/{logo-text.png => logo_text.png} | Bin apps/templates/_footer.html | 2 +- apps/templates/_user_profile.html | 8 ++--- apps/templates/base.html | 14 ++------ apps/templates/flash_message_standalone.html | 13 ++----- apps/users/templates/users/_base_otp.html | 8 ++--- .../templates/users/forgot_password.html | 11 ++---- .../users/templates/users/reset_password.html | 6 ++-- 14 files changed, 38 insertions(+), 84 deletions(-) rename apps/{users/templates/users => authentication/templates/authentication}/login.html (96%) rename apps/{users/templates/users => authentication/templates/authentication}/login_otp.html (97%) rename apps/{users/templates/users => authentication/templates/authentication}/new_login.html (78%) rename apps/static/img/{login/login_image_1.png => login_image.png} (100%) rename apps/static/img/{logo-text.png => logo_text.png} (100%) diff --git a/apps/users/templates/users/login.html b/apps/authentication/templates/authentication/login.html similarity index 96% rename from apps/users/templates/users/login.html rename to apps/authentication/templates/authentication/login.html index beacbacb8..e565e209c 100644 --- a/apps/users/templates/users/login.html +++ b/apps/authentication/templates/authentication/login.html @@ -7,7 +7,7 @@ Jumpserver - + {% include '_head_css_js.html' %} @@ -42,7 +42,7 @@
- + {% trans 'Login' %}
diff --git a/apps/users/templates/users/login_otp.html b/apps/authentication/templates/authentication/login_otp.html similarity index 97% rename from apps/users/templates/users/login_otp.html rename to apps/authentication/templates/authentication/login_otp.html index 005c4817f..d697cdf30 100644 --- a/apps/users/templates/users/login_otp.html +++ b/apps/authentication/templates/authentication/login_otp.html @@ -6,8 +6,8 @@ - Jumpserver - + {{ JMS_TITLE }} + {% include '_head_css_js.html' %} diff --git a/apps/users/templates/users/new_login.html b/apps/authentication/templates/authentication/new_login.html similarity index 78% rename from apps/users/templates/users/new_login.html rename to apps/authentication/templates/authentication/new_login.html index 1172001c4..9bd0fe581 100644 --- a/apps/users/templates/users/new_login.html +++ b/apps/authentication/templates/authentication/new_login.html @@ -6,18 +6,9 @@ - {% if interface and interface.favicon %} - - {% else %} - - {% endif %} - + - {% if interface and interface.login_title %} - {{ interface.login_title }} - {% else %} - Jumpserver - {% endif %} + {{ JMS_TITLE }} @@ -65,24 +56,13 @@
- {% if interface.login_image %} - - {% else %} - - {% endif %} +
- {% if interface.login_title %} -
- {{ interface.login_title }} -
- {% else %} -
- {% trans 'Welcome to the Jumpserver open source fortress' %} -
- {% endif %} - +
+ {{ JMS_TITLE }} +
{% trans 'Welcome back, please enter username and password to login' %}
diff --git a/apps/authentication/views/login.py b/apps/authentication/views/login.py index 89d647291..fc2270eba 100644 --- a/apps/authentication/views/login.py +++ b/apps/authentication/views/login.py @@ -43,7 +43,7 @@ class UserLoginView(FormView): key_prefix_captcha = "_LOGIN_INVALID_{}" def get_template_names(self): - template_name = 'users/login.html' + template_name = 'authentication/login.html' if not settings.XPACK_ENABLED: return template_name @@ -51,7 +51,7 @@ class UserLoginView(FormView): if not License.has_valid_license(): return template_name - template_name = 'users/new_login.html' + template_name = 'authentication/new_login.html' return template_name def get(self, request, *args, **kwargs): @@ -145,7 +145,7 @@ class UserLoginView(FormView): class UserLoginOtpView(FormView): - template_name = 'users/login_otp.html' + template_name = 'authentication/login_otp.html' form_class = forms.UserCheckOtpCodeForm redirect_field_name = 'next' diff --git a/apps/jumpserver/context_processor.py b/apps/jumpserver/context_processor.py index c7a5c34d4..f8967adcf 100644 --- a/apps/jumpserver/context_processor.py +++ b/apps/jumpserver/context_processor.py @@ -1,14 +1,18 @@ # -*- coding: utf-8 -*- # +from django.contrib.staticfiles.templatetags.staticfiles import static def jumpserver_processor(request): - context = {} - # Setting default pk - context.update( - {'DEFAULT_PK': '00000000-0000-0000-0000-000000000000'} - ) + context = { + 'DEFAULT_PK': '00000000-0000-0000-0000-000000000000', + 'LOGO_URL': static('img/logo.png'), + 'LOGO_TEXT_URL': static('img/logo_text.png'), + 'LOGIN_IMAGE_URL': static('img/login_image.png'), + 'FAVICON_URL': static('img/facio.ico'), + 'JMS_TITLE': 'Jumpserver' + } return context diff --git a/apps/static/img/login/login_image_1.png b/apps/static/img/login_image.png similarity index 100% rename from apps/static/img/login/login_image_1.png rename to apps/static/img/login_image.png diff --git a/apps/static/img/logo-text.png b/apps/static/img/logo_text.png similarity index 100% rename from apps/static/img/logo-text.png rename to apps/static/img/logo_text.png diff --git a/apps/templates/_footer.html b/apps/templates/_footer.html index e9f268b1a..869ea76a6 100644 --- a/apps/templates/_footer.html +++ b/apps/templates/_footer.html @@ -1,7 +1,7 @@ {% load i18n %}