mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
fix: corrected statement to when an init code has to be sent (#4817)
* fix: corrected statement to when an init code has to be sent * fix: corrected statement to when an init code has to be sent * fix: corrected statement to when an init code has to be sent * fix: add init code to user handle for auth.users2 Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
2209187a48
commit
a3f15d8213
@ -147,6 +147,10 @@ func (u *User) ProcessUser(event *es_models.Event) (err error) {
|
||||
user_repo.HumanMFAInitSkippedType,
|
||||
user_repo.MachineChangedEventType,
|
||||
user_repo.HumanPasswordChangedType,
|
||||
user_repo.HumanInitialCodeAddedType,
|
||||
user_repo.UserV1InitialCodeAddedType,
|
||||
user_repo.UserV1InitializedCheckSucceededType,
|
||||
user_repo.HumanInitializedCheckSucceededType,
|
||||
user_repo.HumanPasswordlessInitCodeAddedType,
|
||||
user_repo.HumanPasswordlessInitCodeRequestedType:
|
||||
user, err = u.view.UserByID(event.AggregateID, event.InstanceID)
|
||||
|
@ -193,6 +193,9 @@ func AddHumanCommand(a *user.Aggregate, human *AddHuman, passwordAlg crypto.Hash
|
||||
cmds := make([]eventstore.Command, 0, 3)
|
||||
cmds = append(cmds, createCmd)
|
||||
|
||||
if human.Email.Verified {
|
||||
cmds = append(cmds, user.NewHumanEmailVerifiedEvent(ctx, &a.Aggregate))
|
||||
}
|
||||
//add init code if
|
||||
// email not verified or
|
||||
// user not registered and password set
|
||||
@ -203,9 +206,7 @@ func AddHumanCommand(a *user.Aggregate, human *AddHuman, passwordAlg crypto.Hash
|
||||
}
|
||||
cmds = append(cmds, user.NewHumanInitialCodeAddedEvent(ctx, &a.Aggregate, value, expiry))
|
||||
} else {
|
||||
if human.Email.Verified {
|
||||
cmds = append(cmds, user.NewHumanEmailVerifiedEvent(ctx, &a.Aggregate))
|
||||
} else {
|
||||
if !human.Email.Verified {
|
||||
value, expiry, err := newEmailCode(ctx, filter, codeAlg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user