Merge pull request #2498 from bookwyrm-social/use-reactivate

Use user.reactivate when a user confirms their email address
This commit is contained in:
Mouse Reeve 2022-12-11 12:10:21 -08:00 committed by GitHub
commit a9846e7805
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -390,7 +390,10 @@ class User(OrderedCollectionPageMixin, AbstractUser):
self.is_active = True
self.deactivation_reason = None
self.allow_reactivation = False
super().save(broadcast=False)
super().save(
broadcast=False,
update_fields=["deactivation_reason", "is_active", "allow_reactivation"],
)
@property
def local_path(self):

View file

@ -105,9 +105,7 @@ class ConfirmEmailCode(View):
request, "confirm_email/confirm_email.html", {"valid": False}
)
# update the user
user.is_active = True
user.deactivation_reason = None
user.save(broadcast=False, update_fields=["is_active", "deactivation_reason"])
user.reactivate()
# direct the user to log in
return redirect("login", confirmed="confirmed")