Skip to content

Commit

Permalink
Mark registration profile activated when confirming invited user
Browse files Browse the repository at this point in the history
The registration system uses both the `activated` field in addition to the
`User.is_active` fields. Setting `User.is_active` to false after activation lets
us disable an account and prevent the user from reactivating it. Because of this
we must also update the `activated` field.
  • Loading branch information
jwalgran committed May 18, 2018
1 parent 7ea8b1f commit ea2f9fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions opentreemap/manage_treemap/views/user_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ def activate_user(sender, user, request, password=None, **kwargs):

user.is_active = True
user.save_with_user(user)
# The registration system uses both the `activated` field in
# addition to the `User.is_active` fields. Setting `User.is_active`
# to false after activation lets us disable an account and prevent
# the user from reactivating it. Because of this we must also
# update the `activated` field.
user.registrationprofile.activated = True
user.registrationprofile.save()

auser = authenticate(username=user.username,
password=password)
Expand Down

0 comments on commit ea2f9fe

Please sign in to comment.