feat(identity): confirm the email address with a six-digit code from the message

This commit is contained in:
shira committed 2026-10-10 00:52:46 +03:00
1 parent c94434cd09
commit d365a05c96
87 files changed
+4764 -224

No files matched your search

@@ -345,7 +345,7 @@ type Querier interface {
GetEffectivePolicyVersion(ctx context.Context, arg GetEffectivePolicyVersionParams) (PolicyVersion, error)
// Reads a token before password verification; Consume rechecks it in the
// confirmation transaction and clears pending credentials when it succeeds.
GetEmailTokenByHash(ctx context.Context, arg GetEmailTokenByHashParams) (EmailToken, error)
GetEmailTokenByHash(ctx context.Context, arg GetEmailTokenByHashParams) (GetEmailTokenByHashRow, error)
// Explains why ConsumeEmailToken matched no row.
GetEmailTokenState(ctx context.Context, arg GetEmailTokenStateParams) (GetEmailTokenStateRow, error)
GetHoldingIDByFounder(ctx context.Context, founderAccountID pgtype.UUID) (pgtype.UUID, error)
@@ -390,6 +390,11 @@ type Querier interface {
// employer sees it only while they are an active member. No row means the
// content is no longer visible to this recipient.
GetNotificationOrganizationNameForRecipient(ctx context.Context, arg GetNotificationOrganizationNameForRecipientParams) (string, error)
// Reads the newest open verification token that carries a code for the
// unverified account with this normalized address. The registration version
// must be current, so a code of an earlier registration never matches. The
// row is read before the code is compared; the consumption rechecks it.
GetOpenEmailCodeByAddress(ctx context.Context, arg GetOpenEmailCodeByAddressParams) (GetOpenEmailCodeByAddressRow, error)
// Reads only the historical result. It intentionally does not join the live
// organization or membership, whose profile and state may have since changed.
GetOrganizationCreationResult(ctx context.Context, scopeHash []byte) ([]byte, error)
@@ -1043,6 +1048,13 @@ type Querier interface {
// the delivery is no longer pending or waiting, or another worker holds it.
// now is the application clock.
RecordDeliveryFailure(ctx context.Context, arg RecordDeliveryFailureParams) (string, error)
// Counts one failed code or password attempt against an open code. The
// single UPDATE reads and writes the counter under the row lock, so concurrent
// failures serialize and none is lost. The attempt that reaches the limit
// invalidates the token and drops its code and pending credentials, so the
// code and the link both stop working. A token that is no longer open matches
// no row and is left unchanged.
RecordFailedEmailCodeAttempt(ctx context.Context, arg RecordFailedEmailCodeAttemptParams) (bool, error)
// The compare-and-swap of the first view: it applies only to a delivered
// invitation at the version the caller read and before its deadline, and it
// keeps the deadline.