Auth endpoints moved
This commit is contained in:
parent
a633a8737f
commit
e78586bbd6
@ -16,13 +16,10 @@ Including another URLconf
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import include
|
from django.urls import include
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import index, login, logout, register
|
from .views import index
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', index),
|
path('', index),
|
||||||
path('login', login),
|
|
||||||
path('logout', logout),
|
|
||||||
path('register', register),
|
|
||||||
path('users/', include("users.urls")),
|
path('users/', include("users.urls")),
|
||||||
path('questions/', include("questions.urls")),
|
path('questions/', include("questions.urls")),
|
||||||
path('answers/', include("answers.urls")),
|
path('answers/', include("answers.urls")),
|
||||||
|
@ -7,21 +7,3 @@ def index(request):
|
|||||||
# 'latest_question_list': latest_question_list,
|
# 'latest_question_list': latest_question_list,
|
||||||
# }
|
# }
|
||||||
return render(request, 'index.html')
|
return render(request, 'index.html')
|
||||||
|
|
||||||
def login(request):
|
|
||||||
# context = {
|
|
||||||
# 'latest_question_list': latest_question_list,
|
|
||||||
# }
|
|
||||||
return render(request, 'login.html')
|
|
||||||
|
|
||||||
def logout(request):
|
|
||||||
# context = {
|
|
||||||
# 'latest_question_list': latest_question_list,
|
|
||||||
# }
|
|
||||||
return render(request, 'logout.html')
|
|
||||||
|
|
||||||
def register(request):
|
|
||||||
# context = {
|
|
||||||
# 'latest_question_list': latest_question_list,
|
|
||||||
# }
|
|
||||||
return render(request, 'register.html')
|
|
@ -4,7 +4,7 @@ from django.urls import path
|
|||||||
from users.views import UserModelViewSet
|
from users.views import UserModelViewSet
|
||||||
from rest_framework_simplejwt.views import TokenObtainPairView
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||||
from rest_framework_simplejwt.views import TokenRefreshView
|
from rest_framework_simplejwt.views import TokenRefreshView
|
||||||
from .views import PasswordReset, UserPasswordResetConfirmView, RegisterViewSet
|
from .views import PasswordReset, UserPasswordResetConfirmView, RegisterViewSet, login, logout, register
|
||||||
|
|
||||||
|
|
||||||
router = DefaultRouter(trailing_slash=False)
|
router = DefaultRouter(trailing_slash=False)
|
||||||
@ -13,6 +13,8 @@ router.register("items", UserModelViewSet)
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", include(router.urls)),
|
path("", include(router.urls)),
|
||||||
|
path('login', login, name='register'),
|
||||||
|
path('logout', logout, name='register'),
|
||||||
path('register', RegisterViewSet.as_view(), name='register'),
|
path('register', RegisterViewSet.as_view(), name='register'),
|
||||||
path('api/token', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
path('api/token', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||||
path('api/token/refresh', TokenRefreshView.as_view(), name='token_refresh'),
|
path('api/token/refresh', TokenRefreshView.as_view(), name='token_refresh'),
|
||||||
|
@ -7,6 +7,9 @@ from tools.tools import PasswordResetShortcut, PasswordResetConfirmShortcut
|
|||||||
from django.contrib.auth.tokens import default_token_generator
|
from django.contrib.auth.tokens import default_token_generator
|
||||||
from .serializers import UserPasswordResetSerializer, UserPasswordResetConfirmSerializer, RegisterSerializer
|
from .serializers import UserPasswordResetSerializer, UserPasswordResetConfirmSerializer, RegisterSerializer
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
from django.shortcuts import render, redirect
|
||||||
|
from django.template import loader
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UserModelViewSet(viewsets.ModelViewSet):
|
class UserModelViewSet(viewsets.ModelViewSet):
|
||||||
@ -59,4 +62,23 @@ class UserPasswordResetConfirmView(PasswordResetConfirmShortcut, generics.Generi
|
|||||||
"""
|
"""
|
||||||
serializer_class = UserPasswordResetConfirmSerializer
|
serializer_class = UserPasswordResetConfirmSerializer
|
||||||
permission_classes = (permissions.AllowAny, )
|
permission_classes = (permissions.AllowAny, )
|
||||||
token_generator = default_token_generator
|
token_generator = default_token_generator
|
||||||
|
|
||||||
|
|
||||||
|
def login(request):
|
||||||
|
# context = {
|
||||||
|
# 'latest_question_list': latest_question_list,
|
||||||
|
# }
|
||||||
|
return render(request, 'login.html')
|
||||||
|
|
||||||
|
def logout(request):
|
||||||
|
# context = {
|
||||||
|
# 'latest_question_list': latest_question_list,
|
||||||
|
# }
|
||||||
|
return render(request, 'logout.html')
|
||||||
|
|
||||||
|
def register(request):
|
||||||
|
# context = {
|
||||||
|
# 'latest_question_list': latest_question_list,
|
||||||
|
# }
|
||||||
|
return render(request, 'register.html')
|
||||||
|
Loading…
Reference in New Issue
Block a user