mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-10 17:25:35 +00:00
Use user.reactivate when a user confirms their email address
This is cleaner and easier to maintain.
This commit is contained in:
parent
ac8b060d58
commit
50a42dc0a2
2 changed files with 5 additions and 4 deletions
|
@ -390,7 +390,10 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||||
self.is_active = True
|
self.is_active = True
|
||||||
self.deactivation_reason = None
|
self.deactivation_reason = None
|
||||||
self.allow_reactivation = False
|
self.allow_reactivation = False
|
||||||
super().save(broadcast=False)
|
super().save(
|
||||||
|
broadcast=False,
|
||||||
|
update_fields=["deactivation_reason", "is_active", "allow_reactivation"],
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def local_path(self):
|
def local_path(self):
|
||||||
|
|
|
@ -105,9 +105,7 @@ class ConfirmEmailCode(View):
|
||||||
request, "confirm_email/confirm_email.html", {"valid": False}
|
request, "confirm_email/confirm_email.html", {"valid": False}
|
||||||
)
|
)
|
||||||
# update the user
|
# update the user
|
||||||
user.is_active = True
|
user.reactivate()
|
||||||
user.deactivation_reason = None
|
|
||||||
user.save(broadcast=False, update_fields=["is_active", "deactivation_reason"])
|
|
||||||
# direct the user to log in
|
# direct the user to log in
|
||||||
return redirect("login", confirmed="confirmed")
|
return redirect("login", confirmed="confirmed")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue