add code into the email
This commit is contained in:
parent
d03c1b017e
commit
7d88b1e0cb
|
@ -264,6 +264,12 @@ class OAuth2VPToken(models.Model):
|
||||||
|
|
||||||
self.authorization = Authorization.objects.filter(code=code).first()
|
self.authorization = Authorization.objects.filter(code=code).first()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def code(self):
|
||||||
|
if not self.authorization:
|
||||||
|
return ''
|
||||||
|
return self.authorization.code
|
||||||
|
|
||||||
def verifing(self):
|
def verifing(self):
|
||||||
self.result_verify = verify_presentation(self.vp_token)
|
self.result_verify = verify_presentation(self.vp_token)
|
||||||
|
|
||||||
|
@ -312,3 +318,4 @@ class OAuth2VPToken(models.Model):
|
||||||
self.user_info = tk.get(
|
self.user_info = tk.get(
|
||||||
"verifiableCredential", [{}]
|
"verifiableCredential", [{}]
|
||||||
)[-1].get("credentialSubject")
|
)[-1].get("credentialSubject")
|
||||||
|
return json.dumps(self.user_info, indent=2)
|
||||||
|
|
|
@ -110,9 +110,9 @@ class AuthorizeView(UserView, FormView):
|
||||||
|
|
||||||
@method_decorator(csrf_exempt, name='dispatch')
|
@method_decorator(csrf_exempt, name='dispatch')
|
||||||
class VerifyView(View):
|
class VerifyView(View):
|
||||||
subject_template_name = 'verify_subject.txt'
|
subject_template_name = 'email/verify_subject.txt'
|
||||||
email_template_name = 'verify_email.txt'
|
email_template_name = 'email/verify_email.txt'
|
||||||
html_email_template_name = 'verify_email.html'
|
html_email_template_name = 'email/verify_email.html'
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
org = self.validate(request)
|
org = self.validate(request)
|
||||||
|
@ -128,7 +128,6 @@ class VerifyView(View):
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
code = self.request.POST.get("code")
|
code = self.request.POST.get("code")
|
||||||
vp_tk = self.request.POST.get("vp_token")
|
vp_tk = self.request.POST.get("vp_token")
|
||||||
self.verification = {}
|
|
||||||
|
|
||||||
if not vp_tk or not code:
|
if not vp_tk or not code:
|
||||||
raise Http404("Page not Found!")
|
raise Http404("Page not Found!")
|
||||||
|
@ -200,6 +199,7 @@ class VerifyView(View):
|
||||||
"domain": settings.DOMAIN,
|
"domain": settings.DOMAIN,
|
||||||
"url_domain": url_domain,
|
"url_domain": url_domain,
|
||||||
"verification": self.get_verification(),
|
"verification": self.get_verification(),
|
||||||
|
"code": self.vp_token.code,
|
||||||
}
|
}
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -218,6 +218,8 @@ class VerifyView(View):
|
||||||
email_message.attach_alternative(html_email, 'text/html')
|
email_message.attach_alternative(html_email, 'text/html')
|
||||||
return email_message
|
return email_message
|
||||||
|
|
||||||
|
def get_verification(self):
|
||||||
|
return self.vp_token.get_user_info()
|
||||||
|
|
||||||
class AllowCodeView(View):
|
class AllowCodeView(View):
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue