2020-03-01 08:56:21 +03:00
|
|
|
from dj_rest_auth.views import (LoginView, LogoutView, PasswordChangeView,
|
|
|
|
PasswordResetConfirmView, PasswordResetView,
|
|
|
|
UserDetailsView)
|
2020-08-08 02:59:10 +03:00
|
|
|
from django.urls import path
|
2020-04-15 11:44:54 +03:00
|
|
|
from django.conf import settings
|
2014-04-30 23:52:05 +04:00
|
|
|
|
2016-01-05 03:29:47 +03:00
|
|
|
urlpatterns = [
|
2014-10-08 14:19:15 +04:00
|
|
|
# URLs that do not require a session or valid token
|
2020-08-08 02:59:10 +03:00
|
|
|
path('password/reset/', PasswordResetView.as_view(),
|
|
|
|
name='rest_password_reset'),
|
|
|
|
path('password/reset/confirm/', PasswordResetConfirmView.as_view(),
|
|
|
|
name='rest_password_reset_confirm'),
|
|
|
|
path('login/', LoginView.as_view(), name='rest_login'),
|
2014-10-08 14:19:15 +04:00
|
|
|
# URLs that require a user to be logged in with a valid session / token.
|
2020-08-08 02:59:10 +03:00
|
|
|
path('logout/', LogoutView.as_view(), name='rest_logout'),
|
|
|
|
path('user/', UserDetailsView.as_view(), name='rest_user_details'),
|
|
|
|
path('password/change/', PasswordChangeView.as_view(),
|
|
|
|
name='rest_password_change'),
|
2016-01-05 03:29:47 +03:00
|
|
|
]
|
2020-04-15 11:44:54 +03:00
|
|
|
|
2020-04-16 08:28:14 +03:00
|
|
|
if getattr(settings, 'REST_USE_JWT', False):
|
2020-04-15 11:44:54 +03:00
|
|
|
from rest_framework_simplejwt.views import (
|
|
|
|
TokenRefreshView, TokenVerifyView,
|
|
|
|
)
|
|
|
|
|
|
|
|
urlpatterns += [
|
2020-08-08 02:59:10 +03:00
|
|
|
path('token/verify/', TokenVerifyView.as_view(), name='token_verify'),
|
|
|
|
path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
2020-04-15 11:44:54 +03:00
|
|
|
]
|