Create route for accepting an invite
This commit is contained in:
@@ -3,6 +3,7 @@ from flask_wtf.csrf import CSRFError
|
||||
import werkzeug.exceptions as werkzeug_exceptions
|
||||
|
||||
import atst.domain.exceptions as exceptions
|
||||
from atst.domain.invitations import InvitationExpired
|
||||
|
||||
|
||||
def make_error_pages(app):
|
||||
@@ -41,4 +42,15 @@ def make_error_pages(app):
|
||||
500,
|
||||
)
|
||||
|
||||
@app.errorhandler(InvitationExpired)
|
||||
# pylint: disable=unused-variable
|
||||
def expired_invitation(e):
|
||||
log_error(e)
|
||||
return (
|
||||
render_template(
|
||||
"error.html", message="The invitation you followed has expired."
|
||||
),
|
||||
404,
|
||||
)
|
||||
|
||||
return app
|
||||
|
@@ -340,4 +340,8 @@ def update_member(workspace_id, member_id):
|
||||
|
||||
@bp.route("/workspaces/invitation/<invite_id>", methods=["GET"])
|
||||
def accept_invitation(invite_id):
|
||||
pass
|
||||
invite = Invitations.accept(invite_id)
|
||||
|
||||
return redirect(
|
||||
url_for("workspaces.show_workspace", workspace_id=invite.workspace.id)
|
||||
)
|
||||
|
Reference in New Issue
Block a user