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
@@ -0,0 +1,15 @@
package convert
import (
"github.com/zitadel/zitadel/backend/v3/domain"
session_grpc "github.com/zitadel/zitadel/pkg/grpc/session/v2"
)
func CheckRecoveryCodeGRPCToDomain(checkRecoveryCode *session_grpc.CheckRecoveryCode) *domain.CheckTypeRecoveryCode {
if checkRecoveryCode == nil {
return nil
}
return &domain.CheckTypeRecoveryCode{
RecoveryCode: checkRecoveryCode.GetCode(),
}
}
@@ -0,0 +1,39 @@
package convert
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/zitadel/zitadel/backend/v3/domain"
session_grpc "github.com/zitadel/zitadel/pkg/grpc/session/v2"
)
func TestCheckRecoveryCodeGRPCToDomain(t *testing.T) {
t.Parallel()
tests := []struct {
name string
check *session_grpc.CheckRecoveryCode
want *domain.CheckTypeRecoveryCode
}{
{
name: "nil recovery code check",
},
{
name: "recovery code check",
check: &session_grpc.CheckRecoveryCode{
Code: "code1",
},
want: &domain.CheckTypeRecoveryCode{
RecoveryCode: "code1",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got := CheckRecoveryCodeGRPCToDomain(tt.check)
assert.Equal(t, tt.want, got)
})
}
}