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
97dcb4ca
Commit
97dcb4ca
authored
Jan 10, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Locals
parent
95fb1bfd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
views.py
jumpserver/views.py
+4
-0
views.py
juser/views.py
+25
-3
No files found.
jumpserver/views.py
View file @
97dcb4ca
...
...
@@ -10,3 +10,7 @@ def base(request):
def
skin_config
(
request
):
return
render_to_response
(
'skin_config.html'
)
def
header_path
(
header_title
,
path1
,
path2
):
return
header_title
,
path1
,
path2
juser/views.py
View file @
97dcb4ca
...
...
@@ -3,10 +3,31 @@
# Email: ibuler@qq.com
import
time
import
hashlib
import
random
from
django.shortcuts
import
render_to_response
from
juser.models
import
UserGroup
,
User
from
connect
import
PyCrypt
,
KEY
from
jumpserver.views
import
header_path
cryptor
=
PyCrypt
(
KEY
)
def
md5_crypt
(
string
):
return
hashlib
.
new
(
"md5"
,
string
)
.
hexdigest
()
def
gen_rand_pass
(
num
):
"""生成随机密码"""
seed
=
"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
salt_list
=
[]
for
i
in
range
(
num
):
salt_list
.
append
(
random
.
choice
(
seed
))
salt
=
''
.
join
(
salt_list
)
return
salt
class
AddError
(
Exception
):
...
...
@@ -16,6 +37,8 @@ class AddError(Exception):
def
group_add
(
request
):
error
=
''
msg
=
''
header_title
,
path1
,
path2
=
header_path
(
'添加属组 | Add Group'
,
'juser'
,
'group_add'
)
if
request
.
method
==
'POST'
:
group_name
=
request
.
POST
.
get
(
'group_name'
,
None
)
comment
=
request
.
POST
.
get
(
'comment'
,
None
)
...
...
@@ -42,12 +65,11 @@ def group_add(request):
msg
=
u'添加组
%
s 成功'
%
group_name
return
render_to_response
(
'juser/group_add.html'
,
{
'header_title'
:
u'添加属组 | Add Group'
,
'path1'
:
'juser'
,
'path2'
:
'group_add'
,
'error'
:
error
,
'msg'
:
msg
})
locals
())
def
group_list
(
request
):
groups
=
UserGroup
.
objects
.
all
()
return
render_to_response
(
'juser/group_list.html'
,
{
'header_title'
:
u'查看属组 | Add Group'
,
...
...
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