Closed
Description
Currently the invite functionality on the organization page doesn't trigger any email flow. It only adds a user if they have already registered.
flowchart TD
%% Invitation Creation Process
A[Inviter enters email & selects role] --> B{Validation}
B -->|Valid| C[Generate unique token]
B -->|Invalid| B1[Show error message]
C --> D[Create Invitation record]
D --> E[Send email with token link]
E --> F[Show success message]
%% Invitation Acceptance Process
G[Invitee clicks link in email] --> H[Browser loads /invitations/accept]
H --> I{Validate token}
I -->|Invalid/Expired| I1[Show error page]
I -->|Valid| J{Invitee has account?}
%% User has account branch
J -->|Yes| K{User logged in?}
K -->|Yes| L{Email matches?}
L -->|Yes| M[Add user to org with role]
L -->|No| N[Show error: wrong account]
K -->|No| O[Redirect to login with token]
O --> P[User logs in]
P --> L
%% User doesn't have account branch
J -->|No| Q[Redirect to register with email & token]
Q --> R[User registers]
R --> S[Add new user to org with role]
%% Final steps
M --> T[Mark invitation as used]
S --> T
T --> U[Redirect to organization page]
Metadata
Metadata
Assignees
Labels
No labels