Skip to content

Commit 2253147

Browse files
committed
urls: Support sha256-based tokens
Django 3.1 changed the default hashing algorithm used for things like password reset tokens from SHA-1 to SHA-256. As noted in the release notes [1], this is configurable via the 'DEFAULT_HASHING_ALGORITHM' transitional setting, but that's only intended to allow upgrades of multiple instances in a HA deployment and shouldn't be used post upgrade. Instead, we need to fix our URLs to support the longer tokens generated by SHA-256. Long term, we want to replace these regex-based routes with the simpler flask-style template string routes. That's not really backportable so we'll do that separately. [1] https://docs.djangoproject.com/en/3.1/releases/3.1/#default-hashing-algorithm-settings Signed-off-by: Stephen Finucane <[email protected]> Closes: #394 (cherry picked from commit 8d988f1)
1 parent d3aaec8 commit 2253147

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

patchwork/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
),
159159
re_path(
160160
r'^user/password-reset/(?P<uidb64>[0-9A-Za-z_\-]+)/'
161-
r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
161+
r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,32})/$',
162162
auth_views.PasswordResetConfirmView.as_view(),
163163
name='password_reset_confirm',
164164
),
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Fixed a compatability issue with Django 3.1 that prevented users from
5+
resetting their password.
6+
(`#394 <https://github.com/getpatchwork/patchwork/issues/394>`__)

0 commit comments

Comments
 (0)