mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
add new invite/<token_type>/check/<token> endpoint
having `/invite/service/<token>` and `/invite/service/<id>` as two separate routes (the first to validate an invite token, the second to retrieve invite metadata) technically works. Routes are matched from first to last until a match is found. The metadata endpoint only accepts UUIDs, so requests with a UUID will be picked up by the correct endpoint, while requests that don't look like a UUID will carry on searching for an endpoint, and will find the token validation endpoint. So while this works correctly for our normal expected input, it only does so _because the UUID endpoint is first in the file_. This isn't great, and it makes it harder to reason about the URLs when looking at them. To solve this, create the new `invite/service/check/<token>` endpoint. For backwards compatibility, assign this in parallel with the existing route - once the admin uses the new route we can remove the old route and make better guarantees about what endpoint is being hit.
This commit is contained in:
@@ -122,6 +122,7 @@ def get_invited_org_user(invited_org_user_id):
|
||||
|
||||
|
||||
@organisation_invite_blueprint.route('/invite/organisation/<token>', methods=['GET'])
|
||||
@organisation_invite_blueprint.route('/invite/organisation/check/<token>', methods=['GET'])
|
||||
def validate_invitation_token(token):
|
||||
|
||||
max_age_seconds = 60 * 60 * 24 * current_app.config['INVITATION_EXPIRATION_DAYS']
|
||||
|
||||
@@ -100,6 +100,7 @@ def get_invited_user(invited_user_id):
|
||||
|
||||
|
||||
@service_invite.route('/invite/service/<token>', methods=['GET'])
|
||||
@service_invite.route('/invite/service/check/<token>', methods=['GET'])
|
||||
def validate_service_invitation_token(token):
|
||||
|
||||
max_age_seconds = 60 * 60 * 24 * current_app.config['INVITATION_EXPIRATION_DAYS']
|
||||
|
||||
Reference in New Issue
Block a user