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
79300b75
Commit
79300b75
authored
Jan 04, 2016
by
ParInshOvGotQuep
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复找回密码及静态key问题
parent
ed6559bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
install.py
install/install.py
+5
-0
views.py
juser/views.py
+8
-5
No files found.
install/install.py
View file @
79300b75
...
...
@@ -12,6 +12,8 @@ import socket
import
fcntl
import
struct
import
readline
import
random
import
string
jms_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
)))
sys
.
path
.
append
(
jms_dir
)
...
...
@@ -71,12 +73,15 @@ class PreSetup(object):
self
.
mail_addr
=
'hello@jumpserver.org'
self
.
mail_pass
=
''
self
.
ip
=
''
self
.
key
=
''
.
join
(
random
.
choice
(
string
.
ascii_lowercase
+
string
.
digits
)
\
for
_
in
range
(
16
))
def
write_conf
(
self
,
conf_file
=
os
.
path
.
join
(
jms_dir
,
'jumpserver.conf'
)):
color_print
(
'开始写入配置文件'
,
'green'
)
conf
=
ConfigParser
.
ConfigParser
()
conf
.
read
(
conf_file
)
conf
.
set
(
'base'
,
'url'
,
'http://
%
s'
%
self
.
ip
)
conf
.
set
(
'base'
,
'key'
,
self
.
key
)
conf
.
set
(
'db'
,
'host'
,
self
.
db_host
)
conf
.
set
(
'db'
,
'port'
,
self
.
db_port
)
conf
.
set
(
'db'
,
'user'
,
self
.
db_user
)
...
...
juser/views.py
View file @
79300b75
...
...
@@ -313,6 +313,12 @@ def reset_password(request):
hash_encode
=
request
.
GET
.
get
(
'hash'
,
''
)
action
=
'/juser/password/reset/?uuid=
%
s×tamp=
%
s&hash=
%
s'
%
(
uuid_r
,
timestamp
,
hash_encode
)
if
hash_encode
==
PyCrypt
.
md5_crypt
(
uuid_r
+
timestamp
+
KEY
):
if
int
(
time
.
time
())
-
int
(
timestamp
)
>
600
:
return
http_error
(
request
,
u'链接已超时'
)
else
:
return
HttpResponse
(
'hash校验失败'
)
if
request
.
method
==
'POST'
:
password
=
request
.
POST
.
get
(
'password'
)
password_confirm
=
request
.
POST
.
get
(
'password_confirm'
)
...
...
@@ -328,11 +334,8 @@ def reset_password(request):
else
:
return
HttpResponse
(
'用户不存在'
)
if
hash_encode
==
PyCrypt
.
md5_crypt
(
uuid_r
+
timestamp
+
KEY
):
if
int
(
time
.
time
())
-
int
(
timestamp
)
>
600
:
return
http_error
(
request
,
u'链接已超时'
)
else
:
return
render_to_response
(
'juser/reset_password.html'
,
locals
())
else
:
return
render_to_response
(
'juser/reset_password.html'
,
locals
())
return
http_error
(
request
,
u'错误请求'
)
...
...
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