### Blocked by
- [ ] https://github.com/leaderboardsgg/leaderboard-backend/issues/147
Endpoint: POST /account/confirm
Requires authentication.
Responses
[x] If the client does not supply a valid session token, the server must respond with a 401 UNAUTHORIZED status code.
[x] If the session token provided was created on behalf of a user whose role is not REGISTERED, the server must respond with a 409 CONFLICT status code.
[x] If the client supplies a valid session token that was created on behalf of a user whose role is REGISTERED, the server must respond with a 200 OK status code and initiate the confirmation link generation procedure. (See below.) The server may respond to the request before the email is sent to prevent a timeout.
[ ] The server may impose a limit on how often a client can call this endpoint. If the client calls this endpoint too many times within a given timespan, the server may respond with a 429 TOO MANY REQUESTS status code.
Procedure
Inputs:
user ID: GUID
Requirements
[x] A new confirmation record must be created in the database, the UserId field must be the ID of the authenticated user.
[x] An email must be sent to the email address supplied in the email field of the user specified by the UserId field of the confirmation.
TODO: Determine the exact contents of the email.
[x] The email must contain a link to the account confirmation page.
[x] The account confirmation page link must have the path /confirm-account?code={id} where {id} is the newly-created confirmation's ID in Base64 encoding .
[x] The confirmation token must expire 1 hour after creation
Parent issue: #153
Endpoint:
POST /account/confirm
Requires authentication.Responses
401 UNAUTHORIZED
status code.REGISTERED
, the server must respond with a409 CONFLICT
status code.REGISTERED
, the server must respond with a200 OK
status code and initiate the confirmation link generation procedure. (See below.) The server may respond to the request before the email is sent to prevent a timeout.429 TOO MANY REQUESTS
status code.Procedure
Inputs:
Requirements
UserId
field must be the ID of the authenticated user.UserId
field of the confirmation./confirm-account?code={id}
where{id}
is the newly-created confirmation's ID in Base64 encoding .