diff --git a/seahub/two_factor/templates/two_factor/core/login.html b/seahub/two_factor/templates/two_factor/core/login.html index 9ca9450cbc..b4042fbecc 100644 --- a/seahub/two_factor/templates/two_factor/core/login.html +++ b/seahub/two_factor/templates/two_factor/core/login.html @@ -1,8 +1,9 @@ -{% extends "base.html" %} +{% extends "registration/login.html" %} {% load i18n %} {% block main_content %} -
+
+ +
{% endblock %} {% block extra_script %} {% endblock %} diff --git a/seahub/two_factor/views/login.py b/seahub/two_factor/views/login.py index 3cd098d149..151d6a85be 100644 --- a/seahub/two_factor/views/login.py +++ b/seahub/two_factor/views/login.py @@ -1,5 +1,6 @@ # Copyright (c) 2012-2016 Seafile Ltd. import hashlib +import os import re import logging from datetime import datetime @@ -34,6 +35,9 @@ from seahub.two_factor.forms import TOTPTokenAuthForm, BackupTokenAuthForm, Auth from seahub.two_factor.utils import default_device from seahub.two_factor.views.utils import class_view_decorator +from seahub.settings import LOGIN_BG_IMAGE_PATH, MEDIA_ROOT +from seahub.api2.endpoints.admin.login_bg_image import CUSTOM_LOGIN_BG_IMAGE_PATH + # Get an instance of a logger logger = logging.getLogger(__name__) @@ -166,6 +170,14 @@ class TwoFactorVerifyView(SessionWizardView): context['cancel_url'] = settings.LOGOUT_URL context['form_prefix'] = '%s-' % self.steps.current + + login_bg_image_path = LOGIN_BG_IMAGE_PATH + # get path that background image of login page + custom_login_bg_image_file = os.path.join(MEDIA_ROOT, CUSTOM_LOGIN_BG_IMAGE_PATH) + if os.path.exists(custom_login_bg_image_file): + login_bg_image_path = CUSTOM_LOGIN_BG_IMAGE_PATH + context['login_bg_image_path'] = login_bg_image_path + return context def render_done(self, form, **kwargs):