Add URL for password reset confirm

This commit is contained in:
Tanner Collin 2020-06-20 00:29:24 +00:00
parent 00bcf3fee7
commit 41e1359516
3 changed files with 8 additions and 1 deletions

View File

@ -9,7 +9,7 @@ from django.core.files.base import File
from django.core.cache import cache from django.core.cache import cache
from django.utils.timezone import now from django.utils.timezone import now
from rest_framework import viewsets, views, mixins, generics, exceptions 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.permissions import BasePermission, IsAuthenticated, SAFE_METHODS, IsAuthenticatedOrReadOnly
from rest_framework.response import Response from rest_framework.response import Response
from rest_auth.views import PasswordChangeView from rest_auth.views import PasswordChangeView
@ -524,3 +524,8 @@ class RegistrationView(RegisterView):
class PasswordChangeView(PasswordChangeView): class PasswordChangeView(PasswordChangeView):
permission_classes = [AllowMetadata | IsAuthenticated] permission_classes = [AllowMetadata | IsAuthenticated]
serializer_class = serializers.MyPasswordChangeSerializer serializer_class = serializers.MyPasswordChangeSerializer
@api_view()
def null_view(request):
return Response(status=status.HTTP_400_BAD_REQUEST)

View File

@ -265,6 +265,7 @@ EMAIL_HOST_USER = secrets.EMAIL_USER
EMAIL_HOST_PASSWORD = secrets.EMAIL_PASS EMAIL_HOST_PASSWORD = secrets.EMAIL_PASS
EMAIL_USE_TLS = True EMAIL_USE_TLS = True
EMAIL_USE_SSL = False EMAIL_USE_SSL = False
DEFAULT_FROM_EMAIL = 'Protospace Portal <portal@protospace.ca>'
if DEBUG: logger.info('Debug mode ON') if DEBUG: logger.info('Debug mode ON')
logger.info('Test logging for each thread') logger.info('Test logging for each thread')

View File

@ -31,6 +31,7 @@ urlpatterns = [
path('', include(router.urls)), path('', include(router.urls)),
path(ADMIN_ROUTE, admin.site.urls), path(ADMIN_ROUTE, admin.site.urls),
path('api-auth/', include('rest_framework.urls')), path('api-auth/', include('rest_framework.urls')),
url(r'^password-reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[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'^rest-auth/', include('rest_auth.urls')),
url(r'^registration/', views.RegistrationView.as_view(), name='rest_name_register'), url(r'^registration/', views.RegistrationView.as_view(), name='rest_name_register'),
url(r'^password/change/', views.PasswordChangeView.as_view(), name='rest_password_change'), url(r'^password/change/', views.PasswordChangeView.as_view(), name='rest_password_change'),