Skip to content

Commit 1a33e99

Browse files
Change path to re_path and add ?$ to make trailing slash optional (#667)
1 parent 990b2dd commit 1a33e99

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

dj_rest_auth/registration/urls.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
urlpatterns = [
88
path('', RegisterView.as_view(), name='rest_register'),
9-
path('verify-email/', VerifyEmailView.as_view(), name='rest_verify_email'),
10-
path('resend-email/', ResendEmailVerificationView.as_view(), name="rest_resend_email"),
9+
re_path(r'verify-email/?$', VerifyEmailView.as_view(), name='rest_verify_email'),
10+
re_path(r'resend-email/?$', ResendEmailVerificationView.as_view(), name="rest_resend_email"),
1111

1212
# This url is used by django-allauth and empty TemplateView is
1313
# defined just to allow reverse() call inside app, for example when email
@@ -24,8 +24,8 @@
2424
r'^account-confirm-email/(?P<key>[-:\w]+)/$', TemplateView.as_view(),
2525
name='account_confirm_email',
2626
),
27-
path(
28-
'account-email-verification-sent/', TemplateView.as_view(),
27+
re_path(
28+
r'account-email-verification-sent/?$', TemplateView.as_view(),
2929
name='account_email_verification_sent',
3030
),
3131
]

dj_rest_auth/urls.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.urls import path
1+
from django.urls import re_path
22

33
from dj_rest_auth.app_settings import api_settings
44

@@ -10,13 +10,13 @@
1010

1111
urlpatterns = [
1212
# URLs that do not require a session or valid token
13-
path('password/reset/', PasswordResetView.as_view(), name='rest_password_reset'),
14-
path('password/reset/confirm/', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'),
15-
path('login/', LoginView.as_view(), name='rest_login'),
13+
re_path(r'password/reset/?$', PasswordResetView.as_view(), name='rest_password_reset'),
14+
re_path(r'password/reset/confirm/?$', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'),
15+
re_path(r'login/?$', LoginView.as_view(), name='rest_login'),
1616
# URLs that require a user to be logged in with a valid session / token.
17-
path('logout/', LogoutView.as_view(), name='rest_logout'),
18-
path('user/', UserDetailsView.as_view(), name='rest_user_details'),
19-
path('password/change/', PasswordChangeView.as_view(), name='rest_password_change'),
17+
re_path(r'logout/?$', LogoutView.as_view(), name='rest_logout'),
18+
re_path(r'user/?$', UserDetailsView.as_view(), name='rest_user_details'),
19+
re_path(r'password/change/?$', PasswordChangeView.as_view(), name='rest_password_change'),
2020
]
2121

2222
if api_settings.USE_JWT:
@@ -25,6 +25,6 @@
2525
from dj_rest_auth.jwt_auth import get_refresh_view
2626

2727
urlpatterns += [
28-
path('token/verify/', TokenVerifyView.as_view(), name='token_verify'),
29-
path('token/refresh/', get_refresh_view().as_view(), name='token_refresh'),
28+
re_path(r'token/verify/?$', TokenVerifyView.as_view(), name='token_verify'),
29+
re_path(r'token/refresh/?$', get_refresh_view().as_view(), name='token_refresh'),
3030
]

0 commit comments

Comments
 (0)