diff --git a/idhub/verification_portal/models.py b/idhub/verification_portal/models.py index c8e1615..0bd203a 100644 --- a/idhub/verification_portal/models.py +++ b/idhub/verification_portal/models.py @@ -3,7 +3,8 @@ from django.db import models class VPVerifyRequest(models.Model): """ - `nonce` is an opaque random string used to lookup verification requests + `nonce` is an opaque random string used to lookup verification requests. URL-safe. + Example: "UPBQ3JE2DGJYHP5CPSCRIGTHRTCYXMQPNQ" `expected_credentials` is a JSON list of credential types that must be present in this VP. Example: ["FinancialSituationCredential", "HomeConnectivitySurveyCredential"] `expected_contents` is a JSON object that places optional constraints on the contents of the @@ -12,10 +13,12 @@ class VPVerifyRequest(models.Model): `action` is (for now) a JSON object describing the next steps to take if this verification is successful. For example "send mail to with and " Example: {"action": "send_mail", "params": {"to": "orders@somconnexio.coop", "subject": "New client", "body": ...} + `response` is a URL that the user's wallet will redirect the user to. `submitted_on` is used (by a cronjob) to purge old entries that didn't complete verification """ nonce = models.CharField(max_length=50) expected_credentials = models.CharField(max_length=255) expected_contents = models.TextField() action = models.TextField() + response_or_redirect = models.CharField(max_length=255) submitted_on = models.DateTimeField(auto_now=True) diff --git a/idhub/verification_portal/views.py b/idhub/verification_portal/views.py index afc922b..df7cab2 100644 --- a/idhub/verification_portal/views.py +++ b/idhub/verification_portal/views.py @@ -1,7 +1,7 @@ import json from django.core.mail import send_mail -from django.http import HttpResponse +from django.http import HttpResponse, HttpResponseRedirect from .models import VPVerifyRequest from django.shortcuts import get_object_or_404 from more_itertools import flatten, unique_everseen @@ -39,5 +39,6 @@ def verify(request): pass else: raise Exception("Unknown action!") - return HttpResponse("OK! Your verifiable presentation was successfully presented.") + # OK! Your verifiable presentation was successfully presented. + return HttpResponseRedirect(vr.response_or_redirect)