perf: 修改说明

pull/11349/head
ibuler 2023-08-18 16:59:07 +08:00
parent f3af9c3108
commit 78f66c46e8
2 changed files with 7 additions and 4 deletions

View File

@ -235,7 +235,8 @@
{% if not origin_is_allowed %} {% if not origin_is_allowed %}
<div class='alert alert-danger error-info'> <div class='alert alert-danger error-info'>
配置文件存在问题无法完成登录请联系管理员解决或查看最新更新说明 <br/> 配置文件存在问题无法完成登录请联系管理员解决或查看最新更新说明 <br/>
Configuration file has problems and cannot be logged in. Please contact the administrator Configuration file has problems and cannot be logged in. Please contact the administrator <br/>
- {{ origin }} -
</div> </div>
{% endif %} {% endif %}
<div class="login-content extra-fields-{{ extra_fields_count }}"> <div class="login-content extra-fields-{{ extra_fields_count }}">

View File

@ -140,12 +140,13 @@ class UserLoginContextMixin:
try: try:
referer = urlparse(http_referer) referer = urlparse(http_referer)
except ValueError: except ValueError:
return False return False, None
allowed_domains = settings.ALLOWED_DOMAINS allowed_domains = settings.ALLOWED_DOMAINS
return referer.netloc in allowed_domains return referer.netloc in allowed_domains, referer.netloc
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
origin_allowed, origin = self.origin_is_allowed()
context.update({ context.update({
'demo_mode': os.environ.get("DEMO_MODE"), 'demo_mode': os.environ.get("DEMO_MODE"),
'auth_methods': self.get_support_auth_methods(), 'auth_methods': self.get_support_auth_methods(),
@ -153,7 +154,8 @@ class UserLoginContextMixin:
'current_lang': self.get_current_lang(), 'current_lang': self.get_current_lang(),
'forgot_password_url': self.get_forgot_password_url(), 'forgot_password_url': self.get_forgot_password_url(),
'extra_fields_count': self.get_extra_fields_count(context), 'extra_fields_count': self.get_extra_fields_count(context),
'origin_is_allowed': self.origin_is_allowed(), 'origin_is_allowed': origin_allowed,
'origin': origin,
**self.get_user_mfa_context(self.request.user) **self.get_user_mfa_context(self.request.user)
}) })
return context return context