Add change password form to webclient
This commit is contained in:
@@ -3,6 +3,7 @@ from django.db.models import Max
|
||||
from rest_framework import viewsets, views, mixins, generics, exceptions
|
||||
from rest_framework.permissions import BasePermission, IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
from rest_auth.views import PasswordChangeView
|
||||
from rest_auth.registration.views import RegisterView
|
||||
from fuzzywuzzy import fuzz, process
|
||||
from collections import OrderedDict
|
||||
@@ -130,15 +131,8 @@ class MyUserView(views.APIView):
|
||||
return Response(serializer.data)
|
||||
|
||||
|
||||
class RegistrationViewSet(RegisterView):
|
||||
class RegistrationView(RegisterView):
|
||||
serializer_class = serializers.RegistrationSerializer
|
||||
|
||||
#def create(self, request):
|
||||
# data = request.data.copy()
|
||||
# data['username'] = '{}.{}'.format(
|
||||
# data['first_name'],
|
||||
# data['last_name']
|
||||
# ).lower()
|
||||
# request._full_data = data
|
||||
# return super().create(request)
|
||||
|
||||
class PasswordChangeView(PasswordChangeView):
|
||||
permission_classes = [AllowMetadata | IsAuthenticated]
|
||||
|
@@ -223,3 +223,5 @@ ACCOUNT_EMAIL_REQUIRED = True
|
||||
ACCOUNT_EMAIL_VERIFICATION = 'none'
|
||||
ACCOUNT_USERNAME_MIN_LENGTH = 3
|
||||
ACCOUNT_AUTHENTICATION_METHOD = 'username'
|
||||
OLD_PASSWORD_FIELD_ENABLED = True
|
||||
LOGOUT_ON_PASSWORD_CHANGE = False
|
||||
|
@@ -19,6 +19,7 @@ urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('api-auth/', include('rest_framework.urls')),
|
||||
url(r'^rest-auth/', include('rest_auth.urls')),
|
||||
url(r'^registration/', views.RegistrationViewSet.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'^me/', views.MyUserView.as_view(), name='fullmember'),
|
||||
]
|
||||
|
Reference in New Issue
Block a user