Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
9803dd95
Commit
9803dd95
authored
Sep 02, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ico, Modify forget_password
parent
dcff8495
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
87 deletions
+52
-87
jumpserver.css
apps/static/css/jumpserver.css
+20
-8
style.bak.css
apps/static/css/style.bak.css
+0
-0
facio.ico
apps/static/img/facio.ico
+0
-0
models.py
apps/users/models.py
+7
-6
forget_password.html
apps/users/templates/users/forget_password.html
+1
-1
reset_password_success.html.bak
apps/users/templates/users/reset_password_success.html.bak
+0
-53
user_detail.html
apps/users/templates/users/user_detail.html
+13
-17
views.py
apps/users/views.py
+11
-2
No files found.
apps/static/css/jumpserver.css
View file @
9803dd95
...
...
@@ -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
;
}
apps/static/css/style.bak.css
deleted
100644 → 0
View file @
dcff8495
This diff is collapsed.
Click to expand it.
apps/static/img/facio.ico
View replaced file @
dcff8495
View file @
9803dd95
1.59 KB
|
W:
|
H:
1.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
apps/users/models.py
View file @
9803dd95
...
...
@@ -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'
...
...
apps/users/templates/users/forget_password.html
View file @
9803dd95
...
...
@@ -15,7 +15,7 @@
</head>
<body
class=
"gray-bg"
>
<div
class=
"passwordBox
2
animated fadeInDown"
>
<div
class=
"passwordBox animated fadeInDown"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
...
...
apps/users/templates/users/reset_password_success.html.bak
deleted
100644 → 0
View file @
dcff8495
{% 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>
apps/users/templates/users/user_detail.html
View file @
9803dd95
...
...
@@ -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>
<div
class=
"panel panel-primary"
>
<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>
<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>
...
...
apps/users/views.py
View file @
9803dd95
...
...
@@ -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'
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment