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
4a53c3f2
authored
Aug 14, 2013
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hook into django messaging framework
parent
09f1c6fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
sshkey/views.py
+7
-0
No files found.
sshkey/views.py
View file @
4a53c3f2
...
...
@@ -2,6 +2,7 @@ from django.http import HttpResponse, HttpResponseRedirect
from
django.views.decorators.http
import
require_http_methods
,
require_GET
from
django.shortcuts
import
get_object_or_404
,
render_to_response
from
django.template
import
RequestContext
from
django.contrib
import
messages
from
django.contrib.auth.decorators
import
login_required
from
django.core.exceptions
import
PermissionDenied
from
django.core.urlresolvers
import
reverse
...
...
@@ -59,6 +60,8 @@ def userkey_add(request):
url
=
request
.
GET
.
get
(
'next'
,
default_redirect
)
if
not
is_safe_url
(
url
=
url
,
host
=
request
.
get_host
()):
url
=
default_redirect
message
=
'SSH key <code>
%
s</code> was saved.'
%
userkey
.
name
messages
.
success
(
request
,
message
,
fail_silently
=
True
)
return
HttpResponseRedirect
(
url
)
else
:
form
=
UserKeyForm
()
...
...
@@ -82,6 +85,8 @@ def userkey_edit(request, pk):
url
=
request
.
GET
.
get
(
'next'
,
default_redirect
)
if
not
is_safe_url
(
url
=
url
,
host
=
request
.
get_host
()):
url
=
default_redirect
message
=
'SSH key <code>
%
s</code> was saved.'
%
userkey
.
name
messages
.
success
(
request
,
message
,
fail_silently
=
True
)
return
HttpResponseRedirect
(
url
)
else
:
form
=
UserKeyForm
(
instance
=
userkey
)
...
...
@@ -98,4 +103,6 @@ def userkey_delete(request, pk):
if
userkey
.
user
!=
request
.
user
:
raise
PermissionDenied
userkey
.
delete
()
message
=
'SSH key
%
s was deleted.'
%
userkey
.
name
messages
.
success
(
request
,
message
,
fail_silently
=
True
)
return
HttpResponseRedirect
(
reverse
(
'sshkey.views.userkey_list'
))
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