send to api
This commit is contained in:
parent
6dbd5d18a5
commit
59c99d8279
|
@ -1,6 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
import logging
|
import logging
|
||||||
|
import requests
|
||||||
|
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
from django.core.mail import EmailMultiAlternatives
|
from django.core.mail import EmailMultiAlternatives
|
||||||
|
@ -149,10 +150,16 @@ class VerifyView(View):
|
||||||
|
|
||||||
for user in User.objects.filter(is_admin=True):
|
for user in User.objects.filter(is_admin=True):
|
||||||
self.send_email(user)
|
self.send_email(user)
|
||||||
|
self.send_api()
|
||||||
|
|
||||||
response["response"] = "Validation Code {}".format(code)
|
response["response"] = "Validation Code {}".format(code)
|
||||||
return JsonResponse(response)
|
return JsonResponse(response)
|
||||||
|
|
||||||
|
def send_api(self):
|
||||||
|
data = {"vp": self.vp_token.vp_token, "code": self.vp_token.code}
|
||||||
|
url = self.vp_token.org.response_uri
|
||||||
|
requests.post(url, data=data)
|
||||||
|
|
||||||
def validate(self, request):
|
def validate(self, request):
|
||||||
auth_header = request.headers.get('Authorization', b'')
|
auth_header = request.headers.get('Authorization', b'')
|
||||||
auth_data = auth_header.split()
|
auth_data = auth_header.split()
|
||||||
|
|
Loading…
Reference in New Issue