perf: redis AND login page

pull/8457/head
ibuler 2022-06-21 18:43:48 +08:00
parent f1a22575d3
commit 2366da1485
3 changed files with 50 additions and 30 deletions

View File

@ -32,14 +32,33 @@
font-weight: normal;
}
.hr-line-dashed {
border-top: 1px dashed #e7eaec;
color: #ffffff;
background-color: #ffffff;
height: 1px;
margin: 20px 0;
width: 30%;
display: inline-block;
.form-group {
margin-bottom: 30px;
margin-top: 10px;
}
.auth-methods .form-group, .addition .form-group, .has-error .form-group {
margin-bottom: 20px;
margin-top: 10px;
}
.form-group.auto-login {
margin-bottom: 10px;
}
.auth-methods.addition .form-group {
margin-bottom: 15px;
margin-top: 5px;
}
.auth-methods.has-error .form-group, .addition.has-error .form-group {
margin-bottom: 20px;
margin-top: 5px;
}
.auth-methods.has-error.addition .form-group {
margin-bottom: 10px;
margin-top: 5px;
}
.login-content {
@ -84,22 +103,10 @@
margin-top: -8px !important;
}
.no-captcha-challenge .form-group {
margin-bottom: 20px;
}
.jms-title {
padding: 60px 10px 10px;
}
.no-captcha-challenge .jms-title {
padding: 60px 10px 10px;
}
.no-captcha-challenge .welcome-message {
padding-top: 10px;
}
.more-login-items {
margin-top: 10px;
}
@ -149,6 +156,7 @@
}
.more-methods-title {
position: relative;
margin-top: 20px;
}
.more-methods-title:before, .more-methods-title:after {
position: absolute;
@ -173,11 +181,23 @@
.auto-login.form-group .checkbox {
margin: 5px 0;
}
.more-login {
margin-top: 20px;
}
.has-error .more-login {
margin-top: 0;
}
</style>
</head>
<body>
<div class="login-content">
<div class="login-content
{% if form.errors or form.non_field_error %} has-error {% endif %}
{% if auth_methods %} auth-methods {% endif %}
{% if form.captcha or form.mfa_type or form.challenge %} addition {% endif %}
">
<div class="right-image-box">
<a href="{% if not XPACK_ENABLED %}https://github.com/jumpserver/jumpserver.git{% endif %}">
<img src="{{ LOGIN_IMAGE_URL }}" class="right-image" alt="screen-image"/>
@ -241,7 +261,7 @@
{% bootstrap_field form.captcha show_label=False %}
</div>
{% endif %}
<div class="form-group auto-login" style="padding-top: 5px; margin-bottom: 0">
<div class="form-group auto-login" style="margin-bottom: 10px">
<div class="row">
<div class="col-md-6" style="text-align: left">
{% if form.auto_login %}
@ -256,13 +276,13 @@
</div>
</div>
<div class="form-group" style="margin-bottom: 10px;margin-top: 5px">
<div class="form-group">
<button type="submit" class="btn btn-transparent" onclick="doLogin();return false;">
{% trans 'Login' %}
</button>
</div>
<div>
<div class="more-login">
{% if auth_methods %}
<div class="more-methods-title {{ current_lang.code }}">
{% trans "More login options" %}
@ -270,7 +290,7 @@
<div class="more-login-items">
{% for method in auth_methods %}
<a href="{{ method.url }}" class="more-login-item">
<i class="fa"><img src="{{ method.logo }}" height="13" width="13"></i> {{ method.name }}
<i class="fa"><img src="{{ method.logo }}" height="15" width="15"></i> {{ method.name }}
</a>
{% endfor %}
</div>

View File

@ -210,16 +210,16 @@ class UserLoginView(mixins.AuthMixin, FormView):
return forgot_password_url
def get_context_data(self, **kwargs):
context = {
context = super().get_context_data(**kwargs)
context.update({
'demo_mode': os.environ.get("DEMO_MODE"),
'auth_methods': self.get_support_auth_methods(),
'langs': self.get_support_langs(),
'current_lang': self.get_current_lang(),
'forgot_password_url': self.get_forgot_password_url(),
**self.get_user_mfa_context(self.request.user)
}
kwargs.update(context)
return super().get_context_data(**kwargs)
})
return context
class UserLoginGuardView(mixins.AuthMixin, RedirectView):

View File

@ -64,7 +64,7 @@ SWAGGER_SETTINGS = {
# Captcha settings, more see https://django-simple-captcha.readthedocs.io/en/latest/advanced.html
CAPTCHA_IMAGE_SIZE = (180, 34)
CAPTCHA_IMAGE_SIZE = (180, 38)
CAPTCHA_FOREGROUND_COLOR = '#001100'
CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.math_challenge'