Commit 9803dd95 authored by ibuler's avatar ibuler

Add ico, Modify forget_password

parent dcff8495
......@@ -9,18 +9,26 @@
.n-invalid {border: 1px solid #f00;}
.primary-panel {
border-color: #1ab394;
border-style: solid;
border-width: 1px
.primary-panel .ibox-title {
color: #ffffff;
background-color: #1AB394;
}
.primary-panel .ibox-content {
border: 1px solid #1AB394;
}
.info-panel .ibox-title {
color: #ffffff;
background-color: #23c6c8;
}
.info-panel {
border-color: #23c6c8;
border-style: solid;
border-width: 1px
.info-panel .ibox-content {
border: 1px solid #23c6c8;;
}
th a {
color: #676a6c;
}
......@@ -64,3 +72,7 @@ th a {
margin: 0 auto;
padding: 100px 20px 20px 20px;
}
.no-borders-tr td {
border-top: none !important;
}
This diff is collapsed.
apps/static/img/facio.ico

1.59 KB | W: | H:

apps/static/img/facio.ico

1.7 KB | W: | H:

apps/static/img/facio.ico
apps/static/img/facio.ico
apps/static/img/facio.ico
apps/static/img/facio.ico
  • 2-up
  • Swipe
  • Onion skin
......@@ -197,19 +197,20 @@ class User(AbstractUser):
return signing.dumps({'reset': self.id, 'email': self.email})
@classmethod
def reset_password(cls, token, new_password, max_age=3600):
def validate_reset_token(cls, token, max_age=3600):
try:
data = signing.loads(token, max_age=max_age)
user_id = data.get('reset', None)
user_email = data.get('email', '')
user = cls.objects.get(id=user_id, email=user_email)
user.set_password(new_password)
user.save()
return True
except signing.BadSignature, cls.DoesNotExist:
pass
return False
user = None
return user
def reset_password(self, new_password):
self.set_password(new_password)
self.save()
class Meta:
db_table = 'user'
......
......@@ -15,7 +15,7 @@
</head>
<body class="gray-bg">
<div class="passwordBox2 animated fadeInDown">
<div class="passwordBox animated fadeInDown">
<div class="row">
<div class="col-md-12">
......
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
{% include '_head_css_js.html' %}
<link href="{% static "css/jumpserver.css" %}" rel="stylesheet">
<script src="{% static "js/jumpserver.js" %}"></script>
</head>
<body class="gray-bg">
<div class="passwordBox2 animated fadeInDown">
<div class="row">
<div class="col-md-12">
<div class="ibox-content">
<div>
<img src="{% static 'img/logo.png' %}" style="margin: auto" width="82" height="82">
<h2 style="display: inline">Jumpserver</h2>
</div>
<p>
<div class="alert alert-success">
密码重置成功, 请返回登录页面登录系统 </a>.
</div>
</p>
<div class="row">
<div class="col-lg-3">
<a href="{% url "users:login" %}" class="btn btn-primary block full-width m-b">返回</a>
</div>
</div>
</div>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-6">
Copyright Jumpserver.org
</div>
<div class="col-md-6 text-right">
<small>© 2014-2016</small>
</div>
</div>
</div>
</body>
</html>
......@@ -60,7 +60,7 @@
<div class="ibox-content">
<table class="table">
<tbody>
<tr>
<tr class="no-borders-tr">
<td colspan="2">
<img src="{{ user | user_avatar_url }}" class="img-circle" width="64" height="64">
</td>
......@@ -119,16 +119,14 @@
</div>
</div>
<div class="col-sm-5" style="padding-left: 0px;">
<div class="ibox float-e-margins">
<div class="ibox-title " style="background: #1ab394">
<span style="color: white">快速修改</span>
<div class="ibox-tools">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-info-circle"></i> 快速修改
</div>
</div>
<div class="ibox-content primary-panel">
<div class="panel-body">
<table class="table">
<tbody>
<tr>
<tr class="no-borders-tr">
<td width="50%">Active:</td>
<td><span style="float: right">
<div class="switch">
......@@ -166,8 +164,8 @@
</td>
</tr>
<tr>
<td class="no-borders">重置密钥:</td>
<td class="no-borders">
<td>重置密钥:</td>
<td>
<span style="float: right">
<button type="button" class="btn btn-primary btn-xs" style="width: 54px;">重置</button>
</span>
......@@ -178,13 +176,11 @@
</div>
</div>
<div class="ibox float-e-margins">
<div class="ibox-title bg-primary" style="background: #1ab394">
<span style="color: white">用户组</span>
<div class="ibox-tools">
</div>
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-info-circle"></i> 用户组
</div>
<div class="ibox-content primary-panel">
<div class="panel-body">
<table class="table">
<tbody>
<form>
......@@ -199,7 +195,7 @@
</tr>
<tr>
<td colspan="2" class="no-borders">
<button type="button" class="btn btn-primary btn-small">添加到用户组</button>
<button type="button" class="btn btn-info btn-small">添加到用户组</button>
</td>
</tr>
</form>
......
......@@ -187,7 +187,6 @@ class UserForgetPasswordView(TemplateView):
def post(self, request, *args, **kwargs):
email = request.POST.get('email')
print(email)
user = get_object_or_none(User, email=email)
if not user:
return self.get(request, errors='邮件地址错误,请重新输入')
......@@ -225,6 +224,14 @@ class UserResetPasswordSuccessView(TemplateView):
class UserResetPasswordView(TemplateView):
template_name = 'users/reset_password.html'
def get(self, request, *args, **kwargs):
token = request.GET.get('token')
user = User.validate_reset_token(token)
if not user:
kwargs.update({'errors': 'Token不正确或已过期'})
return super(UserResetPasswordView, self).get(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
password = request.POST.get('password')
password_confirm = request.POST.get('password-confirm')
......@@ -233,7 +240,9 @@ class UserResetPasswordView(TemplateView):
if password != password_confirm:
return self.get(request, errors='两次密码不匹配')
if not User.reset_password(token, password):
user = User.validate_reset_token(token)
if not user:
return self.get(request, errors='Token不正确或已过期')
user.reset_password(password)
return HttpResponseRedirect(reverse('users:reset-password-success'))
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