feat: rt sessions OTP email challenge (#11941)

# Which Problems Are Solved

Add OTP Email challenge needed for Create/Set session in the RT model.

# How the Problems Are Solved

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

# Additional Changes
Remove unused fields from `session_challenge_otp_sms.go`

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

---------

Co-authored-by: Marco A. <[email protected]>
This commit is contained in:
Gayathri Vijayan
2026-03-31 11:50:53 +00:00
committed by GitHub
co-authored by Marco A.
parent 9bab764796
commit 7c3d26b23b
11 changed files with 1607 additions and 102 deletions
@@ -1320,17 +1320,11 @@ func updateHumanUserFailedExpectation(ctrl *gomock.Controller, userRepo *domainm
userUpdates = append(userUpdates, humanRepo.SetState(domain.UserStateLocked))
}
userRepo.EXPECT().Human().Times(1).Return(humanRepo)
if err != nil {
humanRepo.EXPECT().
Update(gomock.Any(), gomock.Any(), primaryKeyCondition, userUpdates).
Times(1).
Return(int64(0), err)
return
}
humanRepo.EXPECT().
Update(gomock.Any(), gomock.Any(), primaryKeyCondition, userUpdates).
Times(1).
Return(updateCount, nil)
Return(updateCount, err)
}
func getUserSucceededExpectation(userRepo *domainmock.UserRepo, failedAttempts uint8) {
@@ -1363,17 +1357,10 @@ func updateSessionSucceededExpectation(sessionRepo *domainmock.SessionRepo, chan
func updateSessionFailedExpectation(sessionRepo *domainmock.SessionRepo, change database.Change, err error, updateCount int64) {
primaryKeyCondition := sessionRepo.PrimaryKeyCondition("instance-1", "session-1")
if err != nil {
sessionRepo.EXPECT().
Update(gomock.Any(), gomock.Any(), primaryKeyCondition, change).
Times(1).
Return(updateCount, err)
return
}
sessionRepo.EXPECT().
Update(gomock.Any(), gomock.Any(), primaryKeyCondition, change).
Times(1).
Return(updateCount, nil)
Return(updateCount, err)
}
func getSessionSucceededExpectation(sessionRepo *domainmock.SessionRepo) {