Unverified Commit cccc7427 authored by 老广's avatar 老广 Committed by GitHub

Dev license (#2409)

* [Update] 更新用户组

* [Update] license - 更新翻译

* [Feature] interface - 自定义配置logo,修改前端(待续)

* [Update] interface更新前端页面,两个登陆首页的模版设

* [Update]修改新登陆模版全局变量,国际化翻译,登陆逻辑页面切换

* [Update] 优化Interface前端逻辑

* [Update] Interface 修改前端一些小问题

* [Update] License/Interface 生成翻译信息
parent 859f2d97
......@@ -108,7 +108,6 @@ MIDDLEWARE = [
ROOT_URLCONF = 'jumpserver.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
......
This diff is collapsed.
This diff is collapsed.
......@@ -131,10 +131,18 @@ table.dataTable tbody td.selected td i.text-navy {
margin-right: 5px !important;
}
.m-m-m{
margin-left: 50px !important;
}
.m-10 {
margin: 10px !important;
}
.f-i-l-e{
/*float: left;*/
margin-left: 1000px !important;
/*padding-left: 1000px !important;*/
}
.m-t-10 {
margin-top: 10px !important;
}
......
.login_body {
filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale')";
-moz-background-size: 100% 100%;
background-color: #f2f2f2;
width: 100%;
height: 100%;
}
.login-dialog {
margin-top: -moz-calc((100vh - 575px) / 2);
margin-top: -webkit-calc((100vh - 575px) / 2);
margin-top: calc((100vh - 575px) / 2);
margin-left: auto;
margin-right: auto;
}
.login-container {
width: 100%;
}
.input_shadow-1{
box-shadow:-2px 5px 5px #9999
}
.button-shadow{
box-shadow:-1px 3px 3px #9999 ;
}
.contact-form .form-control-1 {
background-color: transparent;
border: 1px solid #dedede;
box-shadow: none;
height: 45px !important;
color: #0c0c0c;
height: 30px;
font-family: -apple-system, BlinkMacSystemFont, "Neue Haas Grotesk Text Pro", "Arial Nova", "Segoe UI", "Helvetica Neue", ".PingFang SC", "PingFang SC", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "Hiragino Sans GB", sans-serif;
font-size: 14px;
border-radius: 0;
}
.login-logo {
text-align: center;
height: 80px;
width: 500px;
display: table-cell;
vertical-align: middle;
}
.login-logo img {
max-height: 80px;
max-width: 500px;
}
.login-title {
margin-top: 40px;
text-align: left;
font-family: "Microsoft Yahei", sans-serif;
font-size: 16px;
color: #FFFFFF;
letter-spacing: 0;
}
.login-form {
padding: 16px 0;
}
.login-input {
position: relative;
height: 40px;
}
.login-input-control {
background-color: #FFFFFF;
border: 1px solid #0D6FD1;
position: absolute;
padding: 6px 6px 6px 62px;
border-radius: 2px;
width: 500px;
height: 40px;
font-size: 14px;
color: #2C3C4E;
letter-spacing: 0;
display: block;
}
.login-input-invalid {
color: #FF521B;
border-color: #FF521B;
}
.login-input-control:focus {
color: #0D6FD1;
border-color: #0D6FD1;
}
.login-input-control:-webkit-autofill {
-webkit-box-shadow: 0 0 0 50px white inset;
}
.login-input-prefix {
position: absolute;
top: 11px;
left: 20px;
line-height: 18px;
text-align: center;
width: 22px;
height: 20px;
padding: 0 1px;
z-index: 1;
}
.login-input-prefix .fa {
font-size: 20px;
}
.login-input-prefix .fa {
color: #0D6FD1;
}
.login-input-prefix img {
max-width: 20px;
}
.login-error-msg {
position: absolute;
top: 9px;
right: 40px;
line-height: 22px;
color: #FF521B;
font-size: 12px;
letter-spacing: -0.25px;
z-index: 1;
}
.login-input-postfix {
position: absolute;
top: 9px;
right: 10px;
line-height: 20px;
z-index: 1;
}
.login-input-postfix img {
width: 22px;
height: 22px;
}
.login-input-required .fa {
font-size: 20px;
vertical-align: middle;
}
.login-msg {
color: #FF521B;
height: 30px;
padding-right: 20px;
}
.btn-login {
color: #FFFFFF;
background-color: #23A9F6;
border-color: #23A9F6;
border-radius: 30px;
width: 500px;
height: 40px;
font-size: 14px;
letter-spacing: 0;
line-height: 18px;
}
.btn-login:focus,
.btn-login.focus {
color: #fff;
background-color: #23A9F6;
border-color: #23A9F6;
}
.btn-login:hover {
color: #fff;
background-color: #53C0FF;
border-color: #53C0FF;
}
.btn-login:active, .btn-login.active, .open > .dropdown-toggle.btn-login {
color: #fff;
background-color: #0D6FD1;
border-color: #0D6FD1;
}
.btn-login:active:hover,
.btn-login.active:hover,
.open > .dropdown-toggle.btn-login:hover,
.btn-login:active:focus,
.btn-login.active:focus,
.open > .dropdown-toggle.btn-login:focus,
.btn-login:active.focus,
.btn-login.active.focus,
.open > .dropdown-toggle.btn-login.focus {
color: #fff;
background-color: #53C0FF;
border-color: #53C0FF;
}
.btn-login:active,
.btn-login.active,
.open > .dropdown-toggle.btn-login {
background-image: none;
}
.btn-login.disabled,
.btn-login[disabled],
fieldset[disabled] .btn-login,
.btn-login.disabled:hover,
.btn-login[disabled]:hover,
fieldset[disabled] .btn-login:hover,
.btn-login.disabled:focus,
.btn-login[disabled]:focus,
fieldset[disabled] .btn-login:focus,
.btn-login.disabled.focus,
.btn-login[disabled].focus,
fieldset[disabled] .btn-login.focus,
.btn-login.disabled:active,
.btn-login[disabled]:active,
fieldset[disabled] .btn-login:active,
.btn-login.disabled.active,
.btn-login[disabled].active,
fieldset[disabled] .btn-login.active {
color: #fff;
background-color: #23A9F6;
border-color: #23A9F6;
opacity: 0.6;
}
.btn-login .badge {
color: #23A9F6;
background-color: #fff;
}
.contact-form .form-control {
background-color: transparent;
border: 1px solid #dedede;
box-shadow: none;
height: 45px !important;
color: #0c0c0c;
height: 38px;
font-family: -apple-system, BlinkMacSystemFont, "Neue Haas Grotesk Text Pro", "Arial Nova", "Segoe UI", "Helvetica Neue", ".PingFang SC", "PingFang SC", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "Hiragino Sans GB", sans-serif;
font-size: 14px;
border-radius: 0;
}
.contact-form input:hover,
.contact-form textarea:hover,
.contact-form #contact-submit:hover {
border-color: #28ABE3;
}
.contact-form #contact-submit {
border: none;
padding: 15px 0;
width: 100%;
margin: 0;
background: #28ABE3;
color: #fff;
border-radius: 0;
}
.contact-form textarea.form-control {
padding: 10px;
height: 120px !important;
outline: none;
}
.btn-transparent {
color: #fff;
border: 1px solid #fff;
display: inline-block;
font-size: 13px;
letter-spacing: 1px;
padding: 14px 35px;
text-transform: uppercase;
border-radius: 40px;
background: #259980;
width: 100%;
}
.btn-transparent:hover {
color: #fff;
}
.border {
height: 2px;
margin: 20px auto 20px;
position: relative;
width: 80px;
background: #28ABE3;
}
......@@ -3,7 +3,11 @@
<li class="nav-header">
<div class="profile-element" style="height: 65px">
<div href="http://www.jumpserver.org" target="_blank" style="width: 100%; background-image: url({% static 'img/header-profile.png' %})">
<img alt="logo" height="55" width="185" src="/static/img/logo-text.png"/>
{% if interface and interface.logo_index %}
<img alt="logo" height="55" width="185" src="{{ MEDIA_URL }}{{ interface.logo_index }}"/>
{% else %}
<img alt="logo" height="55" width="185" src="{% static 'img/logo-text.png' %}"/>
{% endif %}
</div>
</div>
<div class="logo-element">
......
......@@ -5,8 +5,18 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<title>Jumpserver</title>
<link rel="shortcut icon" href="{% static 'img/facio.ico' %}" type="image/x-icon">
<title>
{% if interface and interface.login_title %}
{{ interface.login_title }}
{% else %}
Jumpserver
{% endif %}
</title>
{% if interface and interface.favicon %}
<link rel="shortcut icon" href="{{ MEDIA_URL }}{{ interface.favicon }}" type="image/x-icon">
{% else %}
<link rel="shortcut icon" href="{% static 'img/facio.ico' %}" type="image/x-icon">
{% endif %}
{% include '_head_css_js.html' %}
<link href="{% static 'css/jumpserver.css' %}" rel="stylesheet">
{% block custom_head_css_js %} {% endblock %}
......
......@@ -22,8 +22,19 @@
<div class="col-md-12">
<div class="ibox-content">
<div>
{% if interface and interface.logo_logout %}
<img src="{{ MEDIA_URL }}{{ interface.logo_logout }}" style="margin: auto" width="82" height="82">
{% else %}
<img src="{% static 'img/logo.png' %}" style="margin: auto" width="82" height="82">
<h2 style="display: inline">Jumpserver</h2>
{% endif %}
<h2 style="display: inline">
{% if interface and interface.login_title %}
{{ interface.login_title }}
{% else %}
{% trans 'Welcome to the Jumpserver open source fortress' %}
{% endif %}
</h2>
</div>
{% if errors %}
<p>
......
......@@ -22,8 +22,12 @@
<div class="col-md-12">
<div class="ibox-content">
{% if interface.logout_logo %}
<img src="{{ MEDIA_URL }}{{ interface.logout_logo }}" style="margin: auto" width="82" height="82">
{% else %}
<img src="{% static 'img/logo.png' %}" style="margin: auto" width="82" height="82">
{% endif %}
<img src="{% static 'img/logo.png' %}" style="margin: auto" width="82" height="82">
<h2 class="font-bold" style="display: inline">{% trans 'Forgot password' %} ?</h2>
<h1></h1>
......
......@@ -6,7 +6,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Jumpserver </title>
<title>Jumpserver</title>
<link rel="shortcut icon" href="{% static "img/facio.ico" %}" type="image/x-icon">
{% include '_head_css_js.html' %}
<link href="{% static "css/jumpserver.css" %}" rel="stylesheet">
......@@ -24,7 +24,7 @@
<div class="row">
<div class="col-md-6">
<h2 class="font-bold">{% trans 'Welcome to the Jumpserver open source fortress' %}</h2>
<h2 class="font-bold" style="text-align: center">{% trans 'Welcome to the Jumpserver open source fortress' %}</h2>
<p>
{% trans "The world's first fully open source fortress, using the GNU GPL v2.0 open source protocol, is a professional operation and maintenance audit system in compliance with 4A." %}
</p>
......@@ -96,8 +96,7 @@
{% endif %}
</form>
<p class="m-t">
</p>
</div>
</div>
</div>
......
{% load static %}
{% load i18n %}
<!DOCTYPE html>
<html>
<!--/*@thymesVar id="LoginConstants" type="com.fit2cloud.support.common.constants.LoginConstants"*/-->
<!--/*@thymesVar id="message" type="java.lang.String"*/-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{% if interface and interface.favicon %}
<link rel="shortcut icon" href="{{ MEDIA_URL }}{{ interface.favicon }}" type="image/x-icon">
{% else %}
<link rel="shortcut icon" href="{% static 'img/facio.ico' %}" type="image/x-icon">
{% endif %}
<title>
{% if interface and interface.login_title %}
{{ interface.login_title }}
{% else %}
Jumpserver
{% endif %}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Stylesheets -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet">
<link href="{% static 'css/bootstrap-style.css' %}" rel="stylesheet">
<link href="{% static 'css/login-style.css' %}" rel="stylesheet">
<!-- scripts -->
<script src="{% static 'js/jquery-2.1.1.js' %}"></script>
<script src="{% static 'js/plugins/sweetalert/sweetalert.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/plugins/datatables/datatables.min.js' %}"></script>
{# <script src="{% static 'js/angular.min.js' %}"></script>#}
<style>
.captcha {
float: right;
}
</style>
</head>
<body>
<div class="login-dialog">
<div class="">
<div class="row" style="height: 472px">
<div class="col-md-4 col-md-offset-2 input_shadow-1" style="text-align: center;background-color: white; padding-right: 0px;height: 100%">
<div style="background-color: white">
{% if interface.login_title %}
<div style="margin-top: 40px">
<span style="font-size: 24px;font-weight:400;color: #151515;letter-spacing: 0;">{{ interface.login_title }}</span>
</div>
{% else %}
<div style="margin-top: 40px">
<span style="font-size: 24px;font-weight:400;color: #151515;letter-spacing: 0;">{% trans 'Welcome to the Jumpserver open source fortress' %}</span>
</div>
{% endif %}
<div style="font-size: 12px;color: #999999;letter-spacing: 0;line-height: 18px;margin-top: 10px">
{% trans 'Welcome back, please enter username and password to login' %}
</div>
<div style="margin-bottom: 10px">
<div>
<div class="col-md-1"></div>
<div class="contact-form col-md-10" style="margin-top: 20px;height: 35px">
<form id="contact-form" action="" method="post" role="form" novalidate="novalidate">
{% csrf_token %}
<div style="height: 48px;color: red">
{% if block_login %}
<p class="red-fonts">{% trans 'Log in frequently and try again later' %}</p>
{% elif password_expired %}
<p class="red-fonts">{% trans 'The user password has expired' %}</p>
{% elif form.errors %}
{% if 'captcha' in form.errors %}
<p class="red-fonts">{% trans 'Captcha invalid' %}</p>
{% else %}
<p class="red-fonts">{{ form.non_field_errors.as_text }}</p>
{% endif %}
{% endif %}
</div>
<div class="form-group">
<input type="text" class="form-control" name="{{ form.username.html_name }}"
placeholder="{% trans 'Username' %}" required=""
value="{% if form.username.value %}{{ form.username.value }}{% endif %}" style="height: 35px">
</div>
<div class="form-group">
<input type="password" class="form-control" name="{{ form.password.html_name }}"
placeholder="{% trans 'Password' %}" required="">
</div>
<div class="form-group" style="height: 50px;margin-bottom: 0px">
{{ form.captcha }}
</div>
<div class="form-group" style="margin-top: 10px">
<button type="submit" class="btn btn-transparent">{% trans 'Login' %}</button>
</div>
<div style="text-align: center">
<a href="{% url 'users:forgot-password' %}">
<small>{% trans 'Forgot password' %}?</small>
</a>
</div>
</form>
</div>
<div class="col-md-1"></div>
</div>
</div>
</div>
</div>
<div class="col-md-4 " style="padding-left: 0px; height: 100%">
{% if interface.login_image %}
<img src="{{ MEDIA_URL }}{{ interface.login_image }}" style="width: 100%; height: 100%;" class="input_shadow-1" />
{% else %}
<img src="{% static 'img/login/login-image.jpg' %}" style="width: 100%; height: 100%;" class="input_shadow-1" />
{% endif %}
</div>
</div>
<div class="col-md-2"></div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from django.urls import reverse_lazy
......
......@@ -42,12 +42,23 @@ __all__ = [
@method_decorator(csrf_protect, name='dispatch')
@method_decorator(never_cache, name='dispatch')
class UserLoginView(FormView):
template_name = 'users/login.html'
form_class = forms.UserLoginForm
form_class_captcha = forms.UserLoginCaptchaForm
redirect_field_name = 'next'
key_prefix_captcha = "_LOGIN_INVALID_{}"
def get_template_names(self):
template_name = 'users/login.html'
if not settings.XPACK_ENABLED:
return template_name
from xpack.plugins.license.models import License
if not License.has_valid_license():
return template_name
template_name = 'users/new_login.html'
return template_name
def get(self, request, *args, **kwargs):
if request.user.is_staff:
return redirect(redirect_user_first_login_or_index(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment