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
d9d3f25d
Commit
d9d3f25d
authored
Nov 12, 2014
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
d6b6e745
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
views.py
webroot/AutoSa/AutoSa/views.py
+3
-6
forms.py
webroot/AutoSa/UserManage/forms.py
+4
-3
No files found.
webroot/AutoSa/AutoSa/views.py
View file @
d9d3f25d
...
@@ -393,9 +393,7 @@ def addUser(request):
...
@@ -393,9 +393,7 @@ def addUser(request):
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
form
=
UserAddForm
(
request
.
POST
)
form
=
UserAddForm
(
request
.
POST
)
if
not
form
.
is_valid
():
if
form
.
is_valid
():
return
HttpResponse
(
'error'
)
else
:
user
=
form
.
cleaned_data
user
=
form
.
cleaned_data
username
=
user
[
'username'
]
username
=
user
[
'username'
]
password
=
user
[
'password'
]
password
=
user
[
'password'
]
...
@@ -808,13 +806,12 @@ def addAssets(request):
...
@@ -808,13 +806,12 @@ def addAssets(request):
idc
=
request
.
POST
.
get
(
'idc'
)
idc
=
request
.
POST
.
get
(
'idc'
)
comment
=
request
.
POST
.
get
(
'comment'
)
comment
=
request
.
POST
.
get
(
'comment'
)
idc
=
IDC
.
objects
.
get
(
id
=
idc
)
if
''
in
(
ip
,
port
,
idc
):
if
''
in
(
ip
,
port
):
error
=
'带*号内容不能为空。'
error
=
'带*号内容不能为空。'
elif
Assets
.
objects
.
filter
(
ip
=
ip
):
elif
Assets
.
objects
.
filter
(
ip
=
ip
):
error
=
'主机已存在。'
error
=
'主机已存在。'
if
not
error
:
if
not
error
:
idc
=
IDC
.
objects
.
get
(
id
=
idc
)
asset
=
Assets
(
ip
=
ip
,
port
=
port
,
idc
=
idc
,
comment
=
comment
)
asset
=
Assets
(
ip
=
ip
,
port
=
port
,
idc
=
idc
,
comment
=
comment
)
asset
.
save
()
asset
.
save
()
msg
=
u'
%
s 添加成功'
%
ip
msg
=
u'
%
s 添加成功'
%
ip
...
...
webroot/AutoSa/UserManage/forms.py
View file @
d9d3f25d
...
@@ -35,14 +35,14 @@ class UserAddForm(forms.Form):
...
@@ -35,14 +35,14 @@ class UserAddForm(forms.Form):
password_again
=
self
.
cleaned_data
[
'password_again'
]
password_again
=
self
.
cleaned_data
[
'password_again'
]
if
password
!=
password_again
:
if
password
!=
password_again
:
raise
forms
.
ValidationError
(
'Password input twice not match
. '
)
raise
forms
.
ValidationError
(
u'密码二次输入不一致
. '
)
return
password_again
return
password_again
def
clean_key_pass_again
(
self
):
def
clean_key_pass_again
(
self
):
key_pass
=
self
.
data
[
'key_pass'
]
key_pass
=
self
.
data
[
'key_pass'
]
key_pass_again
=
self
.
data
[
'key_pass_again'
]
key_pass_again
=
self
.
data
[
'key_pass_again'
]
if
key_pass
!=
key_pass_again
:
if
key_pass
!=
key_pass_again
:
raise
forms
.
ValidationError
(
'Key Password input twice not match
. '
)
raise
forms
.
ValidationError
(
u'密码二次输入不一致
. '
)
if
len
(
key_pass
)
<
6
:
if
len
(
key_pass
)
<
6
:
raise
forms
.
ValidationError
(
'Key Password input twice not match
. '
)
raise
forms
.
ValidationError
(
u'密码二次输入不一致
. '
)
return
key_pass_again
return
key_pass_again
\ No newline at end of file
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