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HvM1n9luOApOJNtuVIlNaSFBxDga8aOkWK9C6mmBex0yTADHOyJj4URGpyWIjpezdv7QHBPo7undHVG8DGFAF8YvMZlQ1SQgOwvyaOCA3_03wKHW9fRVHu52V7kuO6Xv-3QrJSuZjMK0gFFFnaADcshMcbcMmWCp7p1aAKrL1hB3DT3mA_BEeW8bPEm-uB6wWxazcus-DYx_KURFfr-FowmQmm6d_ln6tKJo2kSQSP6amM9EhYzCKT0yu6ei6dc6_0AIgQx2n6XPrMBDJjds74AAarTEi7_90bnwl998FpMCm4BAFJwZpJkRsMIhYEGAFCT7o_GKswwveTGO-8YYz-FTy7TDRiLDnxyJNsA-TYUNE-oXsi8AfnFGRNhN5nI_Db5fUbRMMRlmb9Xwo3QYWZYSZvtkL5lR-uvSM3Y8nLT25YgJvbm2da-la63IzyDn0twM8l2bz8mEsN-YggD4uV_JS47FRClwUYLzXWMErxt1Jx2thH6pcaRfdvoMslfEH9_AUC2oYO
autonumber
participant UE as UserEmail
participant US as User
participant UI
participant RT as Runtime
participant DB
US->>UI: Enters details on sign-up page
US->>UI: Clicks Sign-up
UI->>+RT: POST /account/register
RT->>DB: Create User
RT->>RT: Generate Email Verification Token
par Runtime to UserEmail
RT->>UE: Send email containing verification link /account/verify/{token}
and Runtime to UI
RT-->>-UI: { status: 'okay' }
end

UI->>UI: Show 'Check your email' page
UE-->>US: Email received
US->>+UI: Opens /account/verify/{token}
UI->>US: Displays page asking user to "verify your email address"
US->>UI: Click "Verify email address" button
UI->>+RT: POST /account/verify/{token}
RT->>RT: Checks {token} is for the logged in user
RT->>DB: User.email_verified=true
loop for each pending invite
RT->>DB: Add user to team
RT->>DB: Delete invite
RT->>DB: Update audit log
end
RT-->>-US: Redirect '/'