From 41e1359516c6a303c29cb84479b9923e11654827 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 20 Jun 2020 00:29:24 +0000 Subject: [PATCH] Add URL for password reset confirm --- apiserver/apiserver/api/views.py | 7 ++++++- apiserver/apiserver/settings.py | 1 + apiserver/apiserver/urls.py | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index 026d3f9..4c48c35 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -9,7 +9,7 @@ from django.core.files.base import File from django.core.cache import cache from django.utils.timezone import now from rest_framework import viewsets, views, mixins, generics, exceptions -from rest_framework.decorators import action +from rest_framework.decorators import action, api_view from rest_framework.permissions import BasePermission, IsAuthenticated, SAFE_METHODS, IsAuthenticatedOrReadOnly from rest_framework.response import Response from rest_auth.views import PasswordChangeView @@ -524,3 +524,8 @@ class RegistrationView(RegisterView): class PasswordChangeView(PasswordChangeView): permission_classes = [AllowMetadata | IsAuthenticated] serializer_class = serializers.MyPasswordChangeSerializer + + +@api_view() +def null_view(request): + return Response(status=status.HTTP_400_BAD_REQUEST) diff --git a/apiserver/apiserver/settings.py b/apiserver/apiserver/settings.py index 2580896..104c59c 100644 --- a/apiserver/apiserver/settings.py +++ b/apiserver/apiserver/settings.py @@ -265,6 +265,7 @@ EMAIL_HOST_USER = secrets.EMAIL_USER EMAIL_HOST_PASSWORD = secrets.EMAIL_PASS EMAIL_USE_TLS = True EMAIL_USE_SSL = False +DEFAULT_FROM_EMAIL = 'Protospace Portal ' if DEBUG: logger.info('Debug mode ON') logger.info('Test logging for each thread') diff --git a/apiserver/apiserver/urls.py b/apiserver/apiserver/urls.py index 9e6f391..32dc1f7 100644 --- a/apiserver/apiserver/urls.py +++ b/apiserver/apiserver/urls.py @@ -31,6 +31,7 @@ urlpatterns = [ path('', include(router.urls)), path(ADMIN_ROUTE, admin.site.urls), path('api-auth/', include('rest_framework.urls')), + url(r'^password-reset/confirm/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', views.null_view, name='password_reset_confirm'), url(r'^rest-auth/', include('rest_auth.urls')), url(r'^registration/', views.RegistrationView.as_view(), name='rest_name_register'), url(r'^password/change/', views.PasswordChangeView.as_view(), name='rest_password_change'),