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
38b0f2f5
Commit
38b0f2f5
authored
Jan 04, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #34 from t57root/forget_password_vul
当有用户uuid 或账号姓名电邮地址信息时,可以修改任意账号的密码
parents
ed6559bb
79300b75
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 @
38b0f2f5
...
...
@@ -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 @
38b0f2f5
...
...
@@ -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