mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 04:18:01 +00:00
07b2bac463
# Which Problems Are Solved User created through the User V2 API without any authentication method and possibly unverified email address was not able to login through the current hosted login UI. An unverified email address would result in a mail verification and not an initialization mail like it would with the management API. Also the login UI would then require the user to enter the init code, which the user never received. # How the Problems Are Solved - When verifying the email through the login UI, it will check for existing auth methods (password, IdP, passkeys). In case there are none, the user will be prompted to set a password. - When a user was created through the V2 API with a verified email and no auth method, the user will be prompted to set a password in the login UI. - Since setting a password requires a corresponding code, the code will be generated and sent when login in. # Additional Changes - Changed `RequestSetPassword` to get the codeGenerator from the eventstore instead of getting it from query. # Additional Context - closes https://github.com/zitadel/zitadel/issues/6600 - closes https://github.com/zitadel/zitadel/issues/8235 --------- Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
194 lines
3.6 KiB
Go
194 lines
3.6 KiB
Go
package domain
|
|
|
|
type NextStep interface {
|
|
Type() NextStepType
|
|
}
|
|
|
|
type NextStepType int32
|
|
|
|
const (
|
|
NextStepUnspecified NextStepType = iota
|
|
NextStepLogin
|
|
NextStepUserSelection
|
|
NextStepInitUser
|
|
NextStepPassword
|
|
NextStepChangePassword
|
|
NextStepInitPassword
|
|
NextStepVerifyEmail
|
|
NextStepMFAPrompt
|
|
NextStepMFAVerify
|
|
NextStepRedirectToCallback
|
|
NextStepChangeUsername
|
|
NextStepLinkUsers
|
|
NextStepExternalNotFoundOption
|
|
NextStepExternalLogin
|
|
NextStepGrantRequired
|
|
NextStepPasswordless
|
|
NextStepPasswordlessRegistrationPrompt
|
|
NextStepRegistration
|
|
NextStepProjectRequired
|
|
NextStepRedirectToExternalIDP
|
|
NextStepLoginSucceeded
|
|
)
|
|
|
|
type LoginStep struct{}
|
|
|
|
func (s *LoginStep) Type() NextStepType {
|
|
return NextStepLogin
|
|
}
|
|
|
|
type RegistrationStep struct{}
|
|
|
|
func (s *RegistrationStep) Type() NextStepType {
|
|
return NextStepRegistration
|
|
}
|
|
|
|
type SelectUserStep struct {
|
|
Users []UserSelection
|
|
}
|
|
|
|
func (s *SelectUserStep) Type() NextStepType {
|
|
return NextStepUserSelection
|
|
}
|
|
|
|
type UserSelection struct {
|
|
UserID string
|
|
UserName string
|
|
DisplayName string
|
|
LoginName string
|
|
UserSessionState UserSessionState
|
|
SelectionPossible bool
|
|
AvatarKey string
|
|
ResourceOwner string
|
|
}
|
|
|
|
type UserSessionState int32
|
|
|
|
const (
|
|
UserSessionStateActive UserSessionState = iota
|
|
UserSessionStateTerminated
|
|
)
|
|
|
|
type RedirectToExternalIDPStep struct{}
|
|
|
|
func (s *RedirectToExternalIDPStep) Type() NextStepType {
|
|
return NextStepRedirectToExternalIDP
|
|
}
|
|
|
|
type InitUserStep struct {
|
|
PasswordSet bool
|
|
}
|
|
|
|
func (s *InitUserStep) Type() NextStepType {
|
|
return NextStepInitUser
|
|
}
|
|
|
|
type ExternalNotFoundOptionStep struct{}
|
|
|
|
func (s *ExternalNotFoundOptionStep) Type() NextStepType {
|
|
return NextStepExternalNotFoundOption
|
|
}
|
|
|
|
type PasswordStep struct{}
|
|
|
|
func (s *PasswordStep) Type() NextStepType {
|
|
return NextStepPassword
|
|
}
|
|
|
|
type ExternalLoginStep struct {
|
|
SelectedIDPConfigID string
|
|
}
|
|
|
|
func (s *ExternalLoginStep) Type() NextStepType {
|
|
return NextStepExternalLogin
|
|
}
|
|
|
|
type PasswordlessStep struct {
|
|
PasswordSet bool
|
|
}
|
|
|
|
func (s *PasswordlessStep) Type() NextStepType {
|
|
return NextStepPasswordless
|
|
}
|
|
|
|
type PasswordlessRegistrationPromptStep struct{}
|
|
|
|
func (s *PasswordlessRegistrationPromptStep) Type() NextStepType {
|
|
return NextStepPasswordlessRegistrationPrompt
|
|
}
|
|
|
|
type ChangePasswordStep struct {
|
|
Expired bool
|
|
}
|
|
|
|
func (s *ChangePasswordStep) Type() NextStepType {
|
|
return NextStepChangePassword
|
|
}
|
|
|
|
type InitPasswordStep struct{}
|
|
|
|
func (s *InitPasswordStep) Type() NextStepType {
|
|
return NextStepInitPassword
|
|
}
|
|
|
|
type ChangeUsernameStep struct{}
|
|
|
|
func (s *ChangeUsernameStep) Type() NextStepType {
|
|
return NextStepChangeUsername
|
|
}
|
|
|
|
type VerifyEMailStep struct {
|
|
InitPassword bool
|
|
}
|
|
|
|
func (s *VerifyEMailStep) Type() NextStepType {
|
|
return NextStepVerifyEmail
|
|
}
|
|
|
|
type MFAPromptStep struct {
|
|
Required bool
|
|
MFAProviders []MFAType
|
|
}
|
|
|
|
func (s *MFAPromptStep) Type() NextStepType {
|
|
return NextStepMFAPrompt
|
|
}
|
|
|
|
type MFAVerificationStep struct {
|
|
MFAProviders []MFAType
|
|
}
|
|
|
|
func (s *MFAVerificationStep) Type() NextStepType {
|
|
return NextStepMFAVerify
|
|
}
|
|
|
|
type LinkUsersStep struct{}
|
|
|
|
func (s *LinkUsersStep) Type() NextStepType {
|
|
return NextStepLinkUsers
|
|
}
|
|
|
|
type GrantRequiredStep struct{}
|
|
|
|
func (s *GrantRequiredStep) Type() NextStepType {
|
|
return NextStepGrantRequired
|
|
}
|
|
|
|
type ProjectRequiredStep struct{}
|
|
|
|
func (s *ProjectRequiredStep) Type() NextStepType {
|
|
return NextStepProjectRequired
|
|
}
|
|
|
|
type RedirectToCallbackStep struct{}
|
|
|
|
func (s *RedirectToCallbackStep) Type() NextStepType {
|
|
return NextStepRedirectToCallback
|
|
}
|
|
|
|
type LoginSucceededStep struct{}
|
|
|
|
func (s *LoginSucceededStep) Type() NextStepType {
|
|
return NextStepLoginSucceeded
|
|
}
|