From 05e9b102a008622e03c8e701b041cf8f39542029 Mon Sep 17 00:00:00 2001 From: Almad Date: Sat, 2 Mar 2024 18:06:12 +0100 Subject: [PATCH] Upgrade to Django 2.2 Primarily fix password reset internals --- ddcz/forms/authentication.py | 7 +++++++ requirements.txt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ddcz/forms/authentication.py b/ddcz/forms/authentication.py index e7668903..e936bda4 100644 --- a/ddcz/forms/authentication.py +++ b/ddcz/forms/authentication.py @@ -24,12 +24,19 @@ def get_users(self, email): """ user_profiles = UserProfile.objects.filter(email__iexact=email) + users = [] # Allow resetting password of users that were not migrated yet # This is the only moment beside login that supports migration for up in user_profiles: if not up.user: migrate_user(profile=up) + if up.user and up.user.is_active: + user = up.user + # This is a bit hacky as we rely on Django not to save the changed email field, + # however it's good enough hack to make emails to be sent for now. + # Reconsider email handling once we're fully migrated and on lates Django + user.email = up.email users = tuple( list( diff --git a/requirements.txt b/requirements.txt index 29d86b88..7683ed31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django>=2.1.0,<2.2 +Django>=2.2.0,<2.3 mysqlclient gunicorn sqlparse