I have a simple django app where users can create and login to their accounts.
When a user is registering for a new account, the user object is created and saved in the database with the is_active
flag set to false. Once the user clicks the confirmation email, the user object has its is_active
flag set to true.
I have built out a password reset flow using Django's views: PasswordResetView
, PasswordResetDoneView
, PasswordResetConfirmView
, and PasswordResetCompleteView
.
Everything works as expected unless I am trying to reset the password for an account which has not yet been activated (is_active == False
), in which case, the reset password email is never sent to the user.
The edge case I am considering here is for a user who created an account, and never clicked the registration link which expires after 72 hours, and thus have a user account which exists but is not active. Then the user wants to get a new registration link, and to do so I require a user to enter their username and password (so that no malicious actors can spam a random users email inbox with new registration link emails). If the user has since forgotten their password, they are bricked and cannot activate their account, nor can they refresh their password.
How can I send a password reset link to accounts which are not active?