Skip to content

Commit

Permalink
Merge pull request #2498 from bookwyrm-social/use-reactivate
Browse files Browse the repository at this point in the history
Use user.reactivate when a user confirms their email address
  • Loading branch information
mouse-reeve committed Dec 11, 2022
2 parents 734fb5a + 50a42dc commit a9846e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion bookwyrm/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ def reactivate(self):
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):
Expand Down
4 changes: 1 addition & 3 deletions bookwyrm/views/landing/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ def get(self, request, code): # pylint: disable=unused-argument
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")

Expand Down

0 comments on commit a9846e7

Please sign in to comment.