Commit ebf34021 authored by Jonathan Wiltshire's avatar Jonathan Wiltshire
Browse files

Expose some information for a known fingerprint in the key checker



This lays the foundations for having the javascript checker
on newnm.html tell the user who we think a known fingerprint
belongs to.

Signed-off-by: Jonathan Wiltshire's avatarJonathan Wiltshire <jmw@debian.org>
parent cc59b824
......@@ -21,7 +21,9 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from . import models as kmodels
from backend import models as bmodels
from django import http
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from ratelimit.decorators import ratelimit
import json
import time
......@@ -76,6 +78,17 @@ def keycheck(request, fpr):
"sigs_bad": len(ku.sigs_bad)
})
try:
bf = bmodels.Fingerprint.objects.get(fpr=fpr)
k["person_id"] = bf.user_id
k["person"] = bf.user.fullname
except ObjectDoesNotExist:
k["person_id"] = None
k["person"] = None
except MultipleObjectsReturned:
# Should never happen because of unique constraints
raise
return json_response(k)
except RuntimeError as e:
return json_response({
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment