from django.urls import path, re_path

from wagtail.admin.views import account

urlpatterns = [
    path(
        '', account.PasswordResetView.as_view(), name='wagtailadmin_password_reset'
    ),
    path(
        'done/', account.PasswordResetDoneView.as_view(), name='wagtailadmin_password_reset_done'
    ),
    re_path(
        r'^confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
        account.PasswordResetConfirmView.as_view(), name='wagtailadmin_password_reset_confirm',
    ),
    path(
        'complete/', account.PasswordResetCompleteView.as_view(), name='wagtailadmin_password_reset_complete'
    ),
]

from django.urls import path

from wagtail.admin.views import account

urlpatterns = [
    path(
        '', account.PasswordResetView.as_view(), name='wagtailadmin_password_reset'
    ),
    path(
        'done/', account.PasswordResetDoneView.as_view(), name='wagtailadmin_password_reset_done'
    ),
    path(
        'confirm/<uidb64>/<token>/',
        account.PasswordResetConfirmView.as_view(), name='wagtailadmin_password_reset_confirm',
    ),
    path(
        'complete/', account.PasswordResetCompleteView.as_view(), name='wagtailadmin_password_reset_complete'
    ),
]

Use new-style URL paths for password reset views
Use new-style URL paths for password reset views

This matches what Django has done in the corresponding views:
https://github.com/django/django/blob/5d4b9c1cab03f0d057f0c7751862df0302c65cf9/django/contrib/auth/urls.py
and prevents it from breaking on Django 3.1 (because the token is now longer than the 13+20 chars allowed by the original regexp).

- from django.urls import path, re_path
+ from django.urls import path
  
  from wagtail.admin.views import account
  
  urlpatterns = [
      path(
          '', account.PasswordResetView.as_view(), name='wagtailadmin_password_reset'
      ),
      path(
          'done/', account.PasswordResetDoneView.as_view(), name='wagtailadmin_password_reset_done'
      ),
-     re_path(
+     path(
-         r'^confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
+         'confirm/<uidb64>/<token>/',
          account.PasswordResetConfirmView.as_view(), name='wagtailadmin_password_reset_confirm',
      ),
      path(
          'complete/', account.PasswordResetCompleteView.as_view(), name='wagtailadmin_password_reset_complete'
      ),
  ]
  
Use new-style URL paths for password reset views
## Code Before:
from django.urls import path, re_path

from wagtail.admin.views import account

urlpatterns = [
    path(
        '', account.PasswordResetView.as_view(), name='wagtailadmin_password_reset'
    ),
    path(
        'done/', account.PasswordResetDoneView.as_view(), name='wagtailadmin_password_reset_done'
    ),
    re_path(
        r'^confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
        account.PasswordResetConfirmView.as_view(), name='wagtailadmin_password_reset_confirm',
    ),
    path(
        'complete/', account.PasswordResetCompleteView.as_view(), name='wagtailadmin_password_reset_complete'
    ),
]

## Instruction:
Use new-style URL paths for password reset views
## Code After:
from django.urls import path

from wagtail.admin.views import account

urlpatterns = [
    path(
        '', account.PasswordResetView.as_view(), name='wagtailadmin_password_reset'
    ),
    path(
        'done/', account.PasswordResetDoneView.as_view(), name='wagtailadmin_password_reset_done'
    ),
    path(
        'confirm/<uidb64>/<token>/',
        account.PasswordResetConfirmView.as_view(), name='wagtailadmin_password_reset_confirm',
    ),
    path(
        'complete/', account.PasswordResetCompleteView.as_view(), name='wagtailadmin_password_reset_complete'
    ),
]
