mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 19:28:25 -04:00
[WIP] New user can now accept invite and will be made to
register. On succesful register and verfication they will be added to service and forwarded to dashboard. Nothing is done yet with the permissions requested in the invite to the user.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from flask import (
|
||||
redirect,
|
||||
url_for,
|
||||
abort
|
||||
abort,
|
||||
session
|
||||
)
|
||||
|
||||
from notifications_python_client.errors import HTTPError
|
||||
@@ -15,6 +16,7 @@ from app import (
|
||||
|
||||
@main.route("/invitation/<token>")
|
||||
def accept_invite(token):
|
||||
|
||||
try:
|
||||
invited_user = invite_api_client.accept_invite(token)
|
||||
existing_user = user_api_client.get_user_by_email(invited_user.email_address)
|
||||
@@ -22,11 +24,11 @@ def accept_invite(token):
|
||||
if existing_user:
|
||||
user_api_client.add_user_to_service(invited_user.service,
|
||||
existing_user.id)
|
||||
|
||||
return redirect(url_for('main.service_dashboard', service_id=invited_user.service))
|
||||
else:
|
||||
# TODO implement registration flow for new users
|
||||
abort(404)
|
||||
session['invited_user'] = invited_user.serialize()
|
||||
return redirect(url_for('main.register_from_invite'))
|
||||
|
||||
except HTTPError as e:
|
||||
if e.status_code == 404:
|
||||
abort(404)
|
||||
|
||||
Reference in New Issue
Block a user