mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-10-31 22:19:00 +00:00
Don't allow invalid account reactivation
This commit is contained in:
parent
65e3a31354
commit
11f1a4662e
2 changed files with 5 additions and 1 deletions
|
@ -394,6 +394,8 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
|||
def reactivate(self):
|
||||
"""Now you want to come back, huh?"""
|
||||
# pylint: disable=attribute-defined-outside-init
|
||||
if not user.allow_reactivation:
|
||||
return
|
||||
self.is_active = True
|
||||
self.deactivation_reason = None
|
||||
self.allow_reactivation = False
|
||||
|
|
|
@ -105,7 +105,9 @@ class ConfirmEmailCode(View):
|
|||
|
||||
# look up the user associated with this code
|
||||
try:
|
||||
user = models.User.objects.get(confirmation_code=code)
|
||||
user = models.User.objects.get(
|
||||
confirmation_code=code, deactivation_reason="pending"
|
||||
)
|
||||
except models.User.DoesNotExist:
|
||||
return TemplateResponse(
|
||||
request, "confirm_email/confirm_email.html", {"valid": False}
|
||||
|
|
Loading…
Reference in a new issue