Skip to content

Commit

Permalink
Merge pull request #94 from level12/92-resend-token
Browse files Browse the repository at this point in the history
ensure token is present for resending verification email
  • Loading branch information
guruofgentoo committed Dec 12, 2019
2 parents 6685d52 + 6821bbb commit 01b566f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions keg_auth/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ def resend_verification_email(self, user_id):
user = self.user_by_id(user_id)
if not self.mail_manager:
raise Exception("Tried to resend verification email, but email is not setup.")
# ensure the user object has a fresh token
user.token_generate()
self.mail_manager.send_new_user(user)


Expand Down
3 changes: 3 additions & 0 deletions keg_auth/tests/test_auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,8 @@ def test_resend_verification(self):
with mail_ext.record_messages() as outbox:
self.am.resend_verification_email(user.id)

assert user._token_plain

assert len(outbox) == 1
assert outbox[0].subject == '[KA Demo] User Welcome & Verification'
assert '/verify-account/{}/{}'.format(user.id, user._token_plain) in outbox[0].body

0 comments on commit 01b566f

Please sign in to comment.