2020-03-01 08:56:21 +03:00
|
|
|
from dj_rest_auth.views import (LoginView, LogoutView, PasswordChangeView,
|
|
|
|
PasswordResetConfirmView, PasswordResetView,
|
|
|
|
UserDetailsView)
|
2016-01-05 03:29:47 +03:00
|
|
|
from django.conf.urls import url
|
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
|
2015-08-07 13:54:45 +03:00
|
|
|
url(r'^password/reset/$', PasswordResetView.as_view(),
|
2014-10-08 14:19:15 +04:00
|
|
|
name='rest_password_reset'),
|
2015-08-07 13:54:45 +03:00
|
|
|
url(r'^password/reset/confirm/$', PasswordResetConfirmView.as_view(),
|
2014-10-08 14:19:15 +04:00
|
|
|
name='rest_password_reset_confirm'),
|
2015-08-07 13:54:45 +03:00
|
|
|
url(r'^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.
|
2015-08-07 13:54:45 +03:00
|
|
|
url(r'^logout/$', LogoutView.as_view(), name='rest_logout'),
|
|
|
|
url(r'^user/$', UserDetailsView.as_view(), name='rest_user_details'),
|
|
|
|
url(r'^password/change/$', PasswordChangeView.as_view(),
|
2014-10-08 14:19:15 +04:00
|
|
|
name='rest_password_change'),
|
2016-01-05 03:29:47 +03:00
|
|
|
]
|
2020-04-15 11:44:54 +03:00
|
|
|
|
|
|
|
if getattr(settings, 'REST_USE_JWT', True):
|
|
|
|
from rest_framework_simplejwt.views import (
|
|
|
|
TokenRefreshView, TokenVerifyView,
|
|
|
|
)
|
|
|
|
|
|
|
|
urlpatterns += [
|
2020-04-16 08:28:05 +03:00
|
|
|
url(r'^token/verify/$', TokenVerifyView.as_view(), name='token_verify'),
|
2020-04-15 11:44:54 +03:00
|
|
|
url(r'^token/refresh/$', TokenRefreshView.as_view(), name='token_refresh'),
|
|
|
|
]
|