mirror of
https://github.com/wassname/flask-security.git
synced 2026-08-11 11:18:40 +08:00
Some more polish. Fix a test
This commit is contained in:
@@ -130,7 +130,7 @@ def confirm():
|
||||
"""
|
||||
try:
|
||||
token = request.args.get('confirmation_token', None)
|
||||
user = confirm_by_token(token)
|
||||
confirm_by_token(token)
|
||||
|
||||
except ConfirmationError, e:
|
||||
do_flash(str(e), 'error')
|
||||
@@ -147,8 +147,7 @@ def confirm():
|
||||
|
||||
return redirect('/')
|
||||
|
||||
_do_login(user)
|
||||
do_flash('Thank you! Your email has been confirmed', 'success')
|
||||
do_flash('Your email has been confirmed. You may now log in.', 'success')
|
||||
|
||||
return redirect(security.post_confirm_view or security.post_login_view)
|
||||
|
||||
|
||||
@@ -174,8 +174,10 @@ class ConfirmationTests(SecurityTest):
|
||||
self.register(e)
|
||||
token = users[0].confirmation_token
|
||||
|
||||
r = self.authenticate('dude@lp.com', 'password')
|
||||
self.assertIn('Account requires confirmation', r.data)
|
||||
r = self.client.get('/confirm?confirmation_token=' + token, follow_redirects=True)
|
||||
self.assertIn('Thank you! Your email has been confirmed', r.data)
|
||||
self.assertIn('Your email has been confirmed. You may now log in.', r.data)
|
||||
|
||||
def test_invalid_or_unprovided_token_when_confirming_email(self):
|
||||
r = self.client.get('/confirm', follow_redirects=True)
|
||||
|
||||
Reference in New Issue
Block a user