'How to remove user using Django Allauth API?
When a user in my Django app cancels their account, I set is_active=False
in the auth_user table.
However, if that use signs up again, Allauth complains that the email is already in use, even if I manually change the email field to something else in the auth_user table.
Allauth is going by the email addresses in the 'account_emailaddress' table. So what's the correct API call to tell Allauth to forget that email, while also setting the auth_user table to not active? Is it safe to delete the entry from the 'account_emailaddress' table myself?
Or maybe there's a signal that allauth uses to listen for the record in the auth_user table being completely deleted by my app, and just unsetting 'is_active' isn't enough?
I see no such signal listed in the docs, though there is one for changing the email.
In short, what's the Allauth way to a) suspend and/or b) delete a user?
I'm not concerned about social accounts at the moment, though one will be used later.
The following answer implies it's enough to set is_active=False
as I describe above, but I've found that more is needed if you want to allow that email to be reused.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|