perf: 优化 css

pull/8474/head
ibuler 2 years ago committed by 老广
parent 7e2f81a418
commit ac20bc05ba

@ -33,28 +33,23 @@
}
.form-group {
margin-bottom: 40px;
margin-top: 10px;
}
.addition .form-group, .has-error .form-group {
margin-bottom: 20px;
margin-top: 10px;
margin-bottom: 30px;
margin-top: 20px;
}
.auth-methods.has-error .form-group, .auth-methods.addition .form-group {
margin-bottom: 15px;
margin-top: 5px;
.extra-fields-1 .form-group {
margin-bottom: 30px;
margin-top: 15px;
}
.has-error.addition .form-group {
.extra-fields-2 .form-group {
margin-bottom: 20px;
margin-top: 5px;
margin-top: 10px;
}
.auth-methods.addition.has-error .form-group {
.extra-fields-3 .form-group {
margin-bottom: 10px;
margin-top: 5px;
margin-top: 10px;
}
.login-content {
@ -185,11 +180,7 @@
</head>
<body>
<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="login-content extra-fields-{{ extra_fields_count }}">
<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"/>

@ -209,6 +209,19 @@ class UserLoginView(mixins.AuthMixin, FormView):
forgot_password_url = settings.FORGOT_PASSWORD_URL or forgot_password_url
return forgot_password_url
def get_extra_fields_count(self, context):
count = 0
if self.get_support_auth_methods():
count += 1
form = context.get('form')
if not form:
return count
if set(form.fields.keys()) & {'captcha', 'challenge', 'mfa_type'}:
count += 1
if form.errors or form.non_field_errors():
count += 1
return count
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update({
@ -217,6 +230,7 @@ class UserLoginView(mixins.AuthMixin, FormView):
'langs': self.get_support_langs(),
'current_lang': self.get_current_lang(),
'forgot_password_url': self.get_forgot_password_url(),
'extra_fields_count': self.get_extra_fields_count(context),
**self.get_user_mfa_context(self.request.user)
})
return context

@ -158,7 +158,7 @@ class Config(dict):
'SESSION_COOKIE_DOMAIN': None,
'CSRF_COOKIE_DOMAIN': None,
'SESSION_COOKIE_NAME_PREFIX': None,
'SESSION_COOKIE_AGE': 3600 * 24,
'SESSION_COOKIE_AGE': 3600,
'SESSION_EXPIRE_AT_BROWSER_CLOSE': False,
'LOGIN_URL': reverse_lazy('authentication:login'),
'CONNECTION_TOKEN_EXPIRATION': 5 * 60,

@ -16,9 +16,9 @@ BOOTSTRAP_TOKEN:
# LOG_LEVEL: DEBUG
# LOG_DIR:
# Session expiration setting, Default 24 hour, Also set expired on on browser close
# 浏览器Session过期时间默认24小时, 也可以设置浏览器关闭则过期
# SESSION_COOKIE_AGE: 86400
# Session expiration setting, Default 1 hour, Also set expired on on browser close
# 浏览器Session过期时间默认 1 小时, 也可以设置浏览器关闭则过期
# SESSION_COOKIE_AGE: 3600
# SESSION_EXPIRE_AT_BROWSER_CLOSE: false
# Database setting, Support sqlite3, mysql, postgres ....
@ -53,43 +53,6 @@ REDIS_PORT: 6379
# REDIS_DB_CELERY: 3
# REDIS_DB_CACHE: 4
# Use OpenID Authorization
# 使用 OpenID 进行认证设置
# AUTH_OPENID: False # True or False
# BASE_SITE_URL: None
# AUTH_OPENID_CLIENT_ID: client-id
# AUTH_OPENID_CLIENT_SECRET: client-secret
# AUTH_OPENID_PROVIDER_ENDPOINT: https://op-example.com/
# AUTH_OPENID_PROVIDER_AUTHORIZATION_ENDPOINT: https://op-example.com/authorize
# AUTH_OPENID_PROVIDER_TOKEN_ENDPOINT: https://op-example.com/token
# AUTH_OPENID_PROVIDER_JWKS_ENDPOINT: https://op-example.com/jwks
# AUTH_OPENID_PROVIDER_USERINFO_ENDPOINT: https://op-example.com/userinfo
# AUTH_OPENID_PROVIDER_END_SESSION_ENDPOINT: https://op-example.com/logout
# AUTH_OPENID_PROVIDER_SIGNATURE_ALG: HS256
# AUTH_OPENID_PROVIDER_SIGNATURE_KEY: None
# AUTH_OPENID_SCOPES: "openid profile email"
# AUTH_OPENID_ID_TOKEN_MAX_AGE: 60
# AUTH_OPENID_ID_TOKEN_INCLUDE_CLAIMS: True
# AUTH_OPENID_USE_STATE: True
# AUTH_OPENID_USE_NONCE: True
# AUTH_OPENID_SHARE_SESSION: True
# AUTH_OPENID_IGNORE_SSL_VERIFICATION: True
# AUTH_OPENID_ALWAYS_UPDATE_USER: True
# Use Radius authorization
# 使用Radius来认证
# AUTH_RADIUS: false
# RADIUS_SERVER: localhost
# RADIUS_PORT: 1812
# RADIUS_SECRET:
# CAS 配置
# AUTH_CAS': False,
# CAS_SERVER_URL': "http://host/cas/",
# CAS_ROOT_PROXIED_AS': 'http://jumpserver-host:port',
# CAS_LOGOUT_COMPLETELY': True,
# CAS_VERSION': 3,
# LDAP/AD settings
# LDAP 搜索分页数量
# AUTH_LDAP_SEARCH_PAGED_SIZE: 1000
@ -114,13 +77,6 @@ REDIS_PORT: 6379
# OTP_VALID_WINDOW: 0
# OTP_ISSUER_NAME: Jumpserver
# Perm show single asset to ungrouped node
# 是否把未授权节点资产放入到 未分组 节点中
# PERM_SINGLE_ASSET_TO_UNGROUP_NODE: False
#
# 同一账号仅允许在一台设备登录
# USER_LOGIN_SINGLE_MACHINE_ENABLED: False
#
# 启用定时任务
# PERIOD_TASK_ENABLED: True
#
@ -130,18 +86,12 @@ REDIS_PORT: 6379
# 是否开启 Luna 水印
# SECURITY_WATERMARK_ENABLED: False
# 健康检查的token默认是空
# HEALTH_CHECK_TOKEN: ''
# 浏览器关闭页面后,会话过期
# SESSION_EXPIRE_AT_BROWSER_CLOSE_FORCE: False
# 每次api请求session续期
# SESSION_SAVE_EVERY_REQUEST: True
# 硬盘检查
# DISK_CHECK_ENABLED: True
# 仅允许用户从来源处登录
# ONLY_ALLOW_AUTH_FROM_SOURCE: False

Loading…
Cancel
Save