mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Merge pull request #1752 from alphagov/handle-malformed-tokens-on-invite
Handle malformed invite tokens
This commit is contained in:
@@ -4,7 +4,7 @@ from flask import (
|
||||
current_app
|
||||
)
|
||||
|
||||
from itsdangerous import SignatureExpired
|
||||
from itsdangerous import SignatureExpired, BadData
|
||||
|
||||
from notifications_utils.url_safe_token import check_token
|
||||
|
||||
@@ -38,6 +38,9 @@ def validate_invitation_token(invitation_type, token):
|
||||
['Your invitation to GOV.UK Notify has expired. '
|
||||
'Please ask the person that invited you to send you another one']}
|
||||
raise InvalidRequest(errors, status_code=400)
|
||||
except BadData:
|
||||
errors = {'invitation': 'Something’s wrong with this link. Make sure you’ve copied the whole thing.'}
|
||||
raise InvalidRequest(errors, status_code=400)
|
||||
|
||||
if invitation_type == 'service':
|
||||
invited_user = get_invited_user_by_id(invited_user_id)
|
||||
|
||||
Reference in New Issue
Block a user