astrosat / django-astrosat-users

Common backend library for Astrosat projects' user management
GNU General Public License v3.0
2 stars 0 forks source link

new version of django-allauth broke the check_backend_access decorator #32

Closed allynt closed 4 years ago

allynt commented 4 years ago

Checklist

Describe the bug

Newer versions of Django use path and re_path instead of url when declaring urlpatterns.

django-allauth finally migrated to this new format and it broke my code;

The list comprehension that adds the check_backend_access decorator to all of the django-allauth urlpatterns incorrectly assumed each one could be restructured as a regex. This lead to problems like this:

path("confirm-email/", views.email_verification_sent, name="account_email_verification_sent"),
re_path(r"^confirm-email/(?P<key>[-:\w]+)/$", views.confirm_email,name="account_confirm_email"),

If both of these use re_path, then the 2nd one will never be matched!

To Reproduce

Steps to reproduce the behavior:

  1. Register for a new account
  2. Notice that you are redirected to login instead of the emal_verification view

Expected behavior

Rewrite the list comprehension that defines conditional_backend_url_patterns to take into account the different types of patterns.