64 lines
3.9 KiB
YAML
64 lines
3.9 KiB
YAML
post:
|
|
operationId: ConfirmEmail
|
|
summary: Verify an email with the one-time token from the link.
|
|
description: |-
|
|
Public operation without a session. The verification link has the form `<frontend origin>/verify-email#token=<token>`: the token travels in the URL fragment, so it never reaches a server log or a Referer header. The page first removes the fragment with `history.replaceState`, then waits for an explicit user action, such as a Confirm button, before it posts the token here. A link scanner that only fetches the page therefore does not consume the token.
|
|
|
|
The server looks up the token by its hash and, in one transaction, checks that it is unused, not expired, and bound to the current registration version, marks it used, and marks the email verified. Only one of several parallel requests with the same token succeeds. An expired token of the current registration answers verification_token_expired; an unknown, used, replaced, or superseded token answers verification_token_invalid, even when that token is also expired. Neither refusal changes anything. For both, the client offers a new link and sign-in, because the address may already be verified.
|
|
|
|
Confirmation also requires the password chosen for the registration that issued this token. A token from a replaced registration cannot apply another registration's password or scenario. The server checks the password against the token's pending password hash before consuming the token, then applies that token's password, scenario, and onboarding step only if the current registration's C1 consent matches its registration version. A wrong password or token without pending registration data answers verification_token_invalid and leaves the account and token unchanged.
|
|
|
|
A repeated confirmation with an already used token is not an idempotent 200: exactly one request may succeed for a token, so the outcome of parallel requests stays unambiguous, and the next step after either outcome is sign-in anyway.
|
|
|
|
Success does not start a session: the link may be opened on another device or by a mail scanner, and a session must come only from the password. The response returns the scenario and the saved onboarding step so the client can continue after sign-in. The operation is rate-limited and requires an allowed Origin. Missing Origin, the special value `null`, or an Origin other than the configured public application origin answers csrf_check_failed.
|
|
security: []
|
|
tags:
|
|
- identity
|
|
parameters:
|
|
- name: Origin
|
|
in: header
|
|
required: false
|
|
description: >-
|
|
The exact configured public application origin. This optional parameter
|
|
is read by the server as empty when absent, so the operation answers
|
|
csrf_check_failed rather than treating a missing Origin as an allowed
|
|
request.
|
|
schema:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 2048
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/EmailVerificationRequest
|
|
examples:
|
|
token:
|
|
summary: Token from the link and password chosen during registration
|
|
value:
|
|
token: q3Zt9b2Kx7LmP4vR8sW1yC6nD0fH5jA2eG9uI3oT7kE
|
|
password: "correct horse battery staple"
|
|
responses:
|
|
"200":
|
|
description: The email is verified.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/EmailVerificationResult
|
|
examples:
|
|
candidate:
|
|
summary: A candidate continues with consents
|
|
value:
|
|
email_verified: true
|
|
scenario: candidate
|
|
onboarding_step: candidate_consents
|
|
"400":
|
|
$ref: ../components/responses.yml#/EmailVerificationFailed
|
|
"403":
|
|
$ref: ../components/responses.yml#/CsrfCheckFailed
|
|
"429":
|
|
$ref: ../components/responses.yml#/TooManyRequests
|
|
default:
|
|
$ref: ../components/responses.yml#/Problem
|