validation par email via djoser
This commit is contained in:
parent
f4327b692c
commit
23acbba748
|
|
@ -3,5 +3,5 @@ from django.urls import include, path, re_path
|
|||
from AuthBillet import views as auth_view
|
||||
|
||||
urlpatterns = [
|
||||
re_path('activate/<str:uid>/<str:token>', auth_view.activate.as_view()),
|
||||
path('activate/<str:uid>/<str:token>', auth_view.activate.as_view()),
|
||||
]
|
||||
|
|
@ -5,12 +5,30 @@ from rest_framework import status
|
|||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from djoser.views import UserViewSet
|
||||
import requests
|
||||
from django.db import connection
|
||||
from TiBillet import settings
|
||||
|
||||
class activate(APIView):
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
def get(self, uid, token):
|
||||
print(uid, token)
|
||||
|
||||
return Response(f'{uid} {token}', status=status.HTTP_200_OK)
|
||||
def get(self, request, uid, token):
|
||||
print(uid)
|
||||
print(token)
|
||||
|
||||
domain = self.request.tenant.domain_url
|
||||
protocol = "https"
|
||||
|
||||
if settings.DEBUG :
|
||||
domain += ":8002"
|
||||
protocol = "http"
|
||||
|
||||
post_url = f"{protocol}://{domain}/auth/users/activation/"
|
||||
post_data = {"uid": uid, "token": token}
|
||||
result = requests.post(post_url, data=post_data)
|
||||
content = result.text
|
||||
|
||||
return Response(f'{uid} {token} {result.text} {result.status_code}')
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ class Reservation(models.Model):
|
|||
user_commande = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT)
|
||||
|
||||
event = models.ForeignKey(Event,
|
||||
on_delete=models.CASCADE,
|
||||
on_delete=models.PROTECT,
|
||||
related_name="reservation")
|
||||
|
||||
ANNULEE, MAIL_NON_VALIDEE, NON_PAYEE, VALIDEE, PAYEE = 'NAN', 'MNV', 'NPA', 'VAL', 'PAY'
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ DJOSER = {
|
|||
"PASSWORD_RESET_CONFIRM_URL": "password/reset/confirm/{uid}/{token}",
|
||||
"USERNAME_RESET_CONFIRM_URL": "username/reset/confirm/{uid}/{token}",
|
||||
# "ACTIVATION_URL": "activate/{uid}/{token}",
|
||||
"ACTIVATION_URL": "activate/{uid}/{token}",
|
||||
"ACTIVATION_URL": "user/activate/{uid}/{token}",
|
||||
# "SOCIAL_AUTH_ALLOWED_REDIRECT_URIS": ["http://manap.django-local.org:8002/"],
|
||||
'EMAIL': {
|
||||
'activation': 'AuthBillet.email.ActivationEmail',
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ urlpatterns = [
|
|||
re_path(r'^auth/', include('djoser.urls.authtoken')),
|
||||
re_path(r'^auth/', include('djoser.urls.jwt')),
|
||||
|
||||
path('activate/', include('AuthBillet.urls')),
|
||||
re_path(r'^user/', include('AuthBillet.urls')),
|
||||
|
||||
path('', include('BaseBillet.urls')),
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue