mirror of
https://github.com/wassname/flask-security.git
synced 2026-07-08 00:10:54 +08:00
Make confirm endpoint anonymous only and get rid of invalid test
This commit is contained in:
@@ -170,6 +170,7 @@ def send_confirmation():
|
||||
**_ctx('send_confirmation'))
|
||||
|
||||
|
||||
@anonymous_user_required
|
||||
def confirm_email(token):
|
||||
"""View function which handles a email confirmation request."""
|
||||
after_this_request(_commit)
|
||||
|
||||
@@ -317,20 +317,6 @@ class ConfirmableTests(SecurityTest):
|
||||
msg = self.app.config['SECURITY_MSG_EMAIL_CONFIRMED'][0]
|
||||
self.assertIn(msg, r.data)
|
||||
|
||||
def test_confirm_email_twice_flashes_already_confirmed_message(self):
|
||||
e = 'dude@lp.com'
|
||||
|
||||
with capture_registrations() as registrations:
|
||||
self.register(e)
|
||||
token = registrations[0]['confirm_token']
|
||||
|
||||
url = '/confirm/' + token
|
||||
self.client.get(url, follow_redirects=True)
|
||||
r = self.client.get(url, follow_redirects=True)
|
||||
|
||||
msg = self.app.config['SECURITY_MSG_ALREADY_CONFIRMED'][0]
|
||||
self.assertIn(msg, r.data)
|
||||
|
||||
def test_invalid_token_when_confirming_email(self):
|
||||
r = self.client.get('/confirm/bogus', follow_redirects=True)
|
||||
self.assertIn('Invalid confirmation token', r.data)
|
||||
|
||||
Reference in New Issue
Block a user