Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change path to re_path and add ?$ to make trailing slash optional #667

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dj_rest_auth/registration/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

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

# This url is used by django-allauth and empty TemplateView is
# defined just to allow reverse() call inside app, for example when email
Expand All @@ -24,8 +24,8 @@
r'^account-confirm-email/(?P<key>[-:\w]+)/$', TemplateView.as_view(),
name='account_confirm_email',
),
path(
'account-email-verification-sent/', TemplateView.as_view(),
re_path(
r'account-email-verification-sent/?$', TemplateView.as_view(),
name='account_email_verification_sent',
),
]
18 changes: 9 additions & 9 deletions dj_rest_auth/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.urls import path
from django.urls import re_path

from dj_rest_auth.app_settings import api_settings

Expand All @@ -10,13 +10,13 @@

urlpatterns = [
# URLs that do not require a session or valid token
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'),
re_path(r'password/reset/?$', PasswordResetView.as_view(), name='rest_password_reset'),
re_path(r'password/reset/confirm/?$', PasswordResetConfirmView.as_view(), name='rest_password_reset_confirm'),
re_path(r'login/?$', LoginView.as_view(), name='rest_login'),
# URLs that require a user to be logged in with a valid session / token.
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'),
re_path(r'logout/?$', LogoutView.as_view(), name='rest_logout'),
re_path(r'user/?$', UserDetailsView.as_view(), name='rest_user_details'),
re_path(r'password/change/?$', PasswordChangeView.as_view(), name='rest_password_change'),
]

if api_settings.USE_JWT:
Expand All @@ -25,6 +25,6 @@
from dj_rest_auth.jwt_auth import get_refresh_view

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