Skip to content

Commit

Permalink
Pass confirm token to confirm_instructions_sent signal
Browse files Browse the repository at this point in the history
  • Loading branch information
mafrosis committed Apr 10, 2017
1 parent 518a156 commit c234a67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions flask_security/confirmable.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def send_confirmation_instructions(user):
"""Sends the confirmation instructions email for the specified user.
:param user: The user to send the instructions to
:param token: The confirmation token
"""

confirmation_link, token = generate_confirmation_link(user)
Expand All @@ -44,8 +43,8 @@ def send_confirmation_instructions(user):
'confirmation_instructions', user=user,
confirmation_link=confirmation_link)

confirm_instructions_sent.send(app._get_current_object(), user=user)
return token
confirm_instructions_sent.send(app._get_current_object(), user=user,
token=token)


def generate_confirmation_token(user):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_confirmable.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from flask_security.core import UserMixin
from flask_security.signals import confirm_instructions_sent, user_confirmed
from flask_security.utils import capture_registrations
from flask_security.utils import capture_registrations, string_types

pytestmark = pytest.mark.confirmable()

Expand All @@ -31,9 +31,10 @@ def on_confirmed(app, user):
recorded_confirms.append(user)

@confirm_instructions_sent.connect_via(app)
def on_instructions_sent(app, user):
def on_instructions_sent(app, user, token):
assert isinstance(app, Flask)
assert isinstance(user, UserMixin)
assert isinstance(token, string_types)
recorded_instructions_sent.append(user)

# Test login before confirmation
Expand Down

0 comments on commit c234a67

Please sign in to comment.