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
62cac20b
Commit
62cac20b
authored
Sep 08, 2016
by
xiaokong1937@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #9
parent
ccfe9b9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
login.html
apps/users/templates/users/login.html
+1
-1
views.py
apps/users/views.py
+8
-3
No files found.
apps/users/templates/users/login.html
View file @
62cac20b
...
...
@@ -40,7 +40,7 @@
<div
class=
"col-md-6"
>
<div
class=
"ibox-content"
>
<div><img
src=
"{% static 'img/logo.png' %}"
width=
"82"
height=
"82"
>
<span
class=
"font-bold text-center"
style=
"font-size: 32px; font-family: inherit"
>
{% trans 'Login' %}
</span></div>
<form
class=
"m-t"
role=
"form"
method=
"post"
action=
"
{% url 'users:login' %}
"
>
<form
class=
"m-t"
role=
"form"
method=
"post"
action=
""
>
{% csrf_token %}
{% if form.errors %}
{% if 'captcha' in form.errors %}
...
...
apps/users/views.py
View file @
62cac20b
...
...
@@ -41,12 +41,17 @@ class UserLoginView(FormView):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
user
.
is_staff
:
return
redirect
(
request
.
POST
.
get
(
self
.
redirect_field_name
,
reverse
(
'index'
)
))
return
s
elf
.
render_to_response
(
self
.
get_context_data
(
**
kwargs
)
)
return
redirect
(
self
.
get_success_url
(
))
return
s
uper
(
UserLoginView
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
form_valid
(
self
,
form
):
auth_login
(
self
.
request
,
form
.
get_user
())
return
redirect
(
self
.
request
.
POST
.
get
(
self
.
redirect_field_name
,
reverse
(
'index'
)))
return
redirect
(
self
.
get_success_url
())
def
get_success_url
(
self
):
return
self
.
request
.
POST
.
get
(
self
.
redirect_field_name
,
self
.
request
.
GET
.
get
(
self
.
redirect_field_name
,
reverse
(
'index'
)))
@method_decorator
(
never_cache
,
name
=
'dispatch'
)
...
...
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