Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-sshkey
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
09f1c6fc
authored
Aug 14, 2013
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redirect back to next GET parameter if given
parent
97957b88
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
sshkey/views.py
+11
-2
No files found.
sshkey/views.py
View file @
09f1c6fc
...
...
@@ -5,6 +5,7 @@ from django.template import RequestContext
from
django.contrib.auth.decorators
import
login_required
from
django.core.exceptions
import
PermissionDenied
from
django.core.urlresolvers
import
reverse
from
django.utils.http
import
is_safe_url
from
sshkey
import
settings
from
sshkey.models
import
UserKey
from
sshkey.forms
import
UserKeyForm
...
...
@@ -54,7 +55,11 @@ def userkey_add(request):
form
=
UserKeyForm
(
request
.
POST
,
instance
=
userkey
)
if
form
.
is_valid
():
form
.
save
()
return
HttpResponseRedirect
(
reverse
(
'sshkey.views.userkey_list'
))
default_redirect
=
reverse
(
'sshkey.views.userkey_list'
)
url
=
request
.
GET
.
get
(
'next'
,
default_redirect
)
if
not
is_safe_url
(
url
=
url
,
host
=
request
.
get_host
()):
url
=
default_redirect
return
HttpResponseRedirect
(
url
)
else
:
form
=
UserKeyForm
()
return
render_to_response
(
...
...
@@ -73,7 +78,11 @@ def userkey_edit(request, pk):
form
=
UserKeyForm
(
request
.
POST
,
instance
=
userkey
)
if
form
.
is_valid
():
form
.
save
()
return
HttpResponseRedirect
(
reverse
(
'sshkey.views.userkey_list'
))
default_redirect
=
reverse
(
'sshkey.views.userkey_list'
)
url
=
request
.
GET
.
get
(
'next'
,
default_redirect
)
if
not
is_safe_url
(
url
=
url
,
host
=
request
.
get_host
()):
url
=
default_redirect
return
HttpResponseRedirect
(
url
)
else
:
form
=
UserKeyForm
(
instance
=
userkey
)
return
render_to_response
(
...
...
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