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
c1fb72f3
Commit
c1fb72f3
authored
Jan 30, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ĵ½˳
parent
35d9be5c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
19 deletions
+69
-19
urls.py
jumpserver/urls.py
+2
-0
views.py
jumpserver/views.py
+42
-0
views.py
juser/views.py
+0
-4
base.html
templates/base.html
+3
-3
user_add.html
templates/juser/user_add.html
+7
-1
login.html
templates/login.html
+10
-7
nav.html
templates/nav.html
+2
-2
nav_bar_header.html
templates/nav_bar_header.html
+1
-1
nav_li_profile.html
templates/nav_li_profile.html
+2
-1
No files found.
jumpserver/urls.py
View file @
c1fb72f3
...
...
@@ -8,6 +8,8 @@ urlpatterns = patterns('',
(
r'^$'
,
'jumpserver.views.base'
),
(
r'^skin_config/$'
,
'jumpserver.views.skin_config'
),
(
r'^base/$'
,
'jumpserver.views.base'
),
(
r'^login/$'
,
'jumpserver.views.login'
),
(
r'^logout/$'
,
'jumpserver.views.logout'
),
(
r'^juser/'
,
include
(
'juser.urls'
)),
(
r'^jperm/'
,
include
(
'jperm.urls'
)),
url
(
r'^jasset/'
,
include
(
'jasset.urls'
)),
...
...
jumpserver/views.py
View file @
c1fb72f3
#coding: utf-8
import
hashlib
from
django.http
import
HttpResponse
from
django.shortcuts
import
render_to_response
from
django.http
import
HttpResponseRedirect
from
juser.models
import
User
def
md5_crypt
(
string
):
return
hashlib
.
new
(
"md5"
,
string
)
.
hexdigest
()
def
base
(
request
):
...
...
@@ -12,3 +21,36 @@ def skin_config(request):
return
render_to_response
(
'skin_config.html'
)
def
login
(
request
):
"""登录界面"""
if
request
.
session
.
get
(
'username'
):
return
HttpResponseRedirect
(
'/'
)
if
request
.
method
==
'GET'
:
return
render_to_response
(
'login.html'
)
else
:
username
=
request
.
POST
.
get
(
'username'
)
password
=
request
.
POST
.
get
(
'password'
)
user
=
User
.
objects
.
filter
(
username
=
username
)
if
user
:
user
=
user
[
0
]
if
md5_crypt
(
password
)
==
user
.
password
:
request
.
session
[
'username'
]
=
username
if
user
.
role
==
'SU'
:
request
.
session
[
'role'
]
=
2
elif
user
.
role
==
'GA'
:
request
.
session
[
'role'
]
=
1
else
:
request
.
session
[
'role'
]
=
0
return
HttpResponseRedirect
(
'/'
)
else
:
error
=
'密码错误,请重新输入。'
else
:
error
=
'用户不存在。'
return
render_to_response
(
'login.html'
,
{
'error'
:
error
})
def
logout
(
request
):
request
.
session
.
delete
()
return
HttpResponseRedirect
(
'/login/'
)
juser/views.py
View file @
c1fb72f3
...
...
@@ -33,10 +33,6 @@ if LDAP_ENABLE:
LDAP_ROOT_PW
=
CONF
.
get
(
'ldap'
,
'root_pw'
)
def
md5_crypt
(
string
):
return
hashlib
.
new
(
"md5"
,
string
)
.
hexdigest
()
def
gen_rand_pwd
(
num
):
"""生成随机密码"""
seed
=
"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
...
...
templates/base.html
View file @
c1fb72f3
...
...
@@ -10,7 +10,7 @@
<link
rel=
"shortcut icon"
href=
"/static/img/facio.ico"
type=
"image/x-icon"
>
{% include 'link_css.html' %}
{% include 'script.html' %}
</head>
...
...
@@ -27,7 +27,7 @@
</div>
</div>
<!--{% include 'script.html' %}-->
{#
<!--{% include 'script.html' %}-->
#}
</body>
{% include 'script.html' %}
</html>
templates/juser/user_add.html
View file @
c1fb72f3
...
...
@@ -119,7 +119,7 @@
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"email"
class=
"col-sm-2 control-label"
>
Email
</label>
<label
for=
"email"
class=
"col-sm-2 control-label"
>
Email
<
span
class=
"red-fonts"
>
*
</span><
/label>
<div
class=
"col-sm-8"
>
<input
id=
"email"
name=
"email"
type=
"email"
placeholder=
"Email"
class=
"form-control"
value=
"{{ email }}"
>
</div>
...
...
@@ -191,6 +191,12 @@ $('#userForm').validator({
ok
:
""
,
msg
:
{
required
:
"必须填写"
}
},
"email"
:
{
rule
:
"required"
,
tip
:
"Email"
,
ok
:
""
,
msg
:
{
required
:
"必须填写"
}
},
"role"
:
{
rule
:
"checked"
,
tip
:
"角色"
,
...
...
templates/login.html
View file @
c1fb72f3
...
...
@@ -7,7 +7,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
JumpServer | Login
</title>
<link
rel=
"shortcut icon"
href=
"/static/img/facio.ico"
type=
"image/x-icon"
>
<link
href=
"/static/css/bootstrap.min.css"
rel=
"stylesheet"
>
<link
href=
"/static/font-awesome/css/font-awesome.css"
rel=
"stylesheet"
>
...
...
@@ -22,22 +22,25 @@
<div>
<div>
<h1
class=
"logo-name"
>
JumpServer
</h1>
<h1
class=
"logo-name"
>
<img
src=
"/static/img/logo.png"
>
</h1>
</div>
<h3>
Welcome to JumpServer
</h3>
<form
class=
"m-t"
role=
"form"
method=
"post"
action=
"/login/"
>
{% if error %}
<div
class=
"alert alert-danger text-center"
>
{{ error }}
</div>
{% endif %}
<h2>
Welcome to JumpServer
</h2>
<form
class=
"m-t"
role=
"form"
method=
"post"
action=
""
>
<div
class=
"form-group"
>
<input
type=
"
email"
class=
"form-control"
placeholder=
"Username"
required=
"
"
>
<input
type=
"
text"
name=
"username"
class=
"form-control"
placeholder=
"Username"
required=
"length[6~50]
"
>
</div>
<div
class=
"form-group"
>
<input
type=
"password"
class=
"form-control"
placeholder=
"Password"
required=
""
>
<input
type=
"password"
name=
"password"
class=
"form-control"
placeholder=
"Password"
required=
""
>
</div>
<button
type=
"submit"
class=
"btn btn-primary block full-width m-b"
>
Login
</button>
<a
href=
"#"
><small>
Forgot password?
</small></a>
</form>
<p
class=
"m-t"
>
<small>
Inspinia we app framework base on Bootstrap 3
©
2014
</small>
</p>
<p
class=
"m-t"
>
<small>
<b>
Copyright
</b>
Jumpserver.org Organization © 2014-2015
</small>
</p>
</div>
</div>
...
...
templates/nav.html
View file @
c1fb72f3
...
...
@@ -34,8 +34,8 @@
<li
id=
"jperm"
>
<a
href=
"#"
><i
class=
"fa fa-edit"
></i>
<span
class=
"nav-label"
>
授权管理
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<li><a
href=
"/jperm/perm_list/"
>
主机授权
</a></li>
<li><a
href=
"/jperm/perm_sudo/"
>
Sudo授权
</a></li>
<li
id=
"perm_list"
><a
href=
"/jperm/perm_list/"
>
主机授权
</a></li>
<li
id=
"perm_sudo"
><a
href=
"/jperm/perm_sudo/"
>
Sudo授权
</a></li>
</ul>
</li>
<li
id=
"jlog"
>
...
...
templates/nav_bar_header.html
View file @
c1fb72f3
...
...
@@ -108,7 +108,7 @@
</li>
<li>
<a
href=
"
login.html
"
>
<a
href=
"
/logout/
"
>
<i
class=
"fa fa-sign-out"
></i>
Log out
</a>
</li>
...
...
templates/nav_li_profile.html
View file @
c1fb72f3
...
...
@@ -10,10 +10,11 @@
<li><a
href=
"contacts.html"
>
Contacts
</a></li>
<li><a
href=
"mailbox.html"
>
Mailbox
</a></li>
<li
class=
"divider"
></li>
<li><a
href=
"
login.html
"
>
Logout
</a></li>
<li><a
href=
"
/logout/
"
>
Logout
</a></li>
</ul>
</div>
<div
class=
"logo-element"
>
JS+
</div>
</li>
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