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
590fa21d
authored
Jul 07, 2014
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post to lookup view to update last_used field
Request body should contain UserKey.id
parent
f5ddf5a6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
django_sshkey/views.py
+8
-1
No files found.
django_sshkey/views.py
View file @
590fa21d
...
...
@@ -28,6 +28,7 @@
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.views.decorators.http
import
require_http_methods
,
require_GET
from
django.views.decorators.csrf
import
csrf_exempt
from
django.shortcuts
import
get_object_or_404
,
render_to_response
from
django.template
import
RequestContext
from
django.contrib
import
messages
...
...
@@ -39,8 +40,14 @@ from django_sshkey import settings
from
django_sshkey.models
import
UserKey
from
django_sshkey.forms
import
UserKeyForm
@require_GET
@require_http_methods
([
'GET'
,
'POST'
])
@csrf_exempt
def
lookup
(
request
):
if
request
.
method
==
'POST'
:
payload
=
request
.
read
()
key
=
UserKey
.
objects
.
get
(
id
=
int
(
payload
))
key
.
touch
()
return
HttpResponse
(
str
(
key
.
last_used
),
mimetype
=
'text/plain'
)
try
:
fingerprint
=
request
.
GET
[
'fingerprint'
]
keys
=
UserKey
.
objects
.
filter
(
fingerprint
=
fingerprint
)
...
...
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