feat: rt recovery code check (#11848)

# Which Problems Are Solved

Adding recovery code check step required for the CreateSession RT
implementation.

# How the Problems Are Solved

- Introduce `RecoveryCodeCheckCommand` (validate/execute/events) for
session creation checks
- Add unit tests

# Additional Changes
- refactor password-check code to reuse a shared lockout-policy helper
- add some missing error translations in `internal/static/i18n/en.yaml`

# Additional Context
- Related to https://github.com/zitadel/zitadel/issues/11035

---------

Co-authored-by: Silvan <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This commit is contained in:
Gayathri Vijayan
2026-03-23 10:56:40 +01:00
committed by GitHub
co-authored by Silvan Copilot Autofix powered by AI
parent 471ed4a5d7
commit c6386cb807
8 changed files with 1873 additions and 36 deletions
+3
View File
@@ -114,6 +114,9 @@ func generateAlphanumericCode(length int, withHyphen bool) (string, error) {
return code, nil
}
// ValidateRecoveryCode validates the input code against the saved recovery codes of a user.
// The validation logic is also implemented in backend/v3/domain/session_check_recovery_code.go.
// Keep both implementations in sync until this duplication is removed.
func ValidateRecoveryCode(ctx context.Context, code string, recoveryCodes *HumanRecoveryCodes, hasher *crypto.Hasher) (_ string, err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
+3
View File
@@ -5,6 +5,7 @@ Errors:
IDMissing: "ID missing"
ResourceOwnerMissing: "Resource Owner Organisation missing"
RemoveFailed: "Could not be removed"
PermissionDenied: "Permission denied"
ProjectionName:
Invalid: "Invalid projection name"
Assets:
@@ -513,6 +514,8 @@ Errors:
StorageFailed: "Storing action execution log to database failed"
ScanFailed: "Querying usage for action execution seconds failed"
Session:
IDMissing: "Session ID missing"
NotFound: "Session not found"
NotExisting: "Session does not exist"
Terminated: "Session already terminated"
Expired: "Session has expired"