mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-25 18:55:27 -06:00
feat: choose preferred WebAuthN platform for passwordless registration (#2469)
* feat: request preferred platform type for passwordless registration when using link * add text in console
This commit is contained in:
@@ -661,6 +661,10 @@ func (c *Commands) createPasswordlessRegistrationDoneEvents(ctx context.Context,
|
||||
if event != nil {
|
||||
events = append(events, event)
|
||||
}
|
||||
event = c.createCustomLoginTextEvent(ctx, agg, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, existingText.PasswordlessRegistrationDoneDescriptionClose, text.PasswordlessRegistrationDone.DescriptionClose, text.Language, defaultText)
|
||||
if event != nil {
|
||||
events = append(events, event)
|
||||
}
|
||||
event = c.createCustomLoginTextEvent(ctx, agg, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, existingText.PasswordlessRegistrationDoneNextButtonText, text.PasswordlessRegistrationDone.NextButtonText, text.Language, defaultText)
|
||||
if event != nil {
|
||||
events = append(events, event)
|
||||
|
||||
@@ -182,6 +182,7 @@ type CustomLoginTextReadModel struct {
|
||||
|
||||
PasswordlessRegistrationDoneTitle string
|
||||
PasswordlessRegistrationDoneDescription string
|
||||
PasswordlessRegistrationDoneDescriptionClose string
|
||||
PasswordlessRegistrationDoneNextButtonText string
|
||||
PasswordlessRegistrationDoneCancelButtonText string
|
||||
|
||||
@@ -1703,6 +1704,10 @@ func (wm *CustomLoginTextReadModel) handlePasswordlessRegistrationDoneScreenSetE
|
||||
wm.PasswordlessRegistrationDoneDescription = e.Text
|
||||
return
|
||||
}
|
||||
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose {
|
||||
wm.PasswordlessRegistrationDoneDescriptionClose = e.Text
|
||||
return
|
||||
}
|
||||
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneNextButtonText {
|
||||
wm.PasswordlessRegistrationDoneNextButtonText = e.Text
|
||||
return
|
||||
@@ -1722,6 +1727,10 @@ func (wm *CustomLoginTextReadModel) handlePasswordlessRegistrationDoneScreenRemo
|
||||
wm.PasswordlessRegistrationDoneDescription = ""
|
||||
return
|
||||
}
|
||||
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose {
|
||||
wm.PasswordlessRegistrationDoneDescriptionClose = ""
|
||||
return
|
||||
}
|
||||
if e.Key == domain.LoginKeyPasswordlessRegistrationDoneNextButtonText {
|
||||
wm.PasswordlessRegistrationDoneNextButtonText = ""
|
||||
return
|
||||
|
||||
@@ -684,6 +684,11 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, "Description", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextSetEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, "DescriptionClose", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextSetEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, "NextButtonText", language.English,
|
||||
@@ -1320,6 +1325,7 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
PasswordlessRegistrationDone: domain.PasswordlessRegistrationDoneScreenText{
|
||||
Title: "Title",
|
||||
Description: "Description",
|
||||
DescriptionClose: "DescriptionClose",
|
||||
NextButtonText: "NextButtonText",
|
||||
CancelButtonText: "CancelButtonText",
|
||||
},
|
||||
@@ -2081,6 +2087,11 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, "Description", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextSetEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, "DescriptionClose", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextSetEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, "NextButtonText", language.English,
|
||||
@@ -3174,6 +3185,11 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextRemovedEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextRemovedEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, language.English,
|
||||
@@ -3641,41 +3657,41 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
config: &domain.CustomLoginText{
|
||||
Language: language.English,
|
||||
SelectAccount: domain.SelectAccountScreenText{},
|
||||
Login: domain.LoginScreenText{},
|
||||
Password: domain.PasswordScreenText{},
|
||||
UsernameChange: domain.UsernameChangeScreenText{},
|
||||
UsernameChangeDone: domain.UsernameChangeDoneScreenText{},
|
||||
InitPassword: domain.InitPasswordScreenText{},
|
||||
InitPasswordDone: domain.InitPasswordDoneScreenText{},
|
||||
EmailVerification: domain.EmailVerificationScreenText{},
|
||||
EmailVerificationDone: domain.EmailVerificationDoneScreenText{},
|
||||
InitUser: domain.InitializeUserScreenText{},
|
||||
InitUserDone: domain.InitializeUserDoneScreenText{},
|
||||
InitMFAPrompt: domain.InitMFAPromptScreenText{},
|
||||
InitMFAOTP: domain.InitMFAOTPScreenText{},
|
||||
InitMFAU2F: domain.InitMFAU2FScreenText{},
|
||||
InitMFADone: domain.InitMFADoneScreenText{},
|
||||
MFAProvider: domain.MFAProvidersText{},
|
||||
VerifyMFAOTP: domain.VerifyMFAOTPScreenText{},
|
||||
VerifyMFAU2F: domain.VerifyMFAU2FScreenText{},
|
||||
Passwordless: domain.PasswordlessScreenText{},
|
||||
PasswordlessPrompt: domain.PasswordlessPromptScreenText{},
|
||||
PasswordlessRegistration: domain.PasswordlessRegistrationScreenText{},
|
||||
PasswordlessRegistrationDone: domain.PasswordlessRegistrationDoneScreenText{},
|
||||
PasswordChange: domain.PasswordChangeScreenText{},
|
||||
PasswordChangeDone: domain.PasswordChangeDoneScreenText{},
|
||||
PasswordResetDone: domain.PasswordResetDoneScreenText{},
|
||||
RegisterOption: domain.RegistrationOptionScreenText{},
|
||||
RegistrationUser: domain.RegistrationUserScreenText{},
|
||||
Language: language.English,
|
||||
SelectAccount: domain.SelectAccountScreenText{},
|
||||
Login: domain.LoginScreenText{},
|
||||
Password: domain.PasswordScreenText{},
|
||||
UsernameChange: domain.UsernameChangeScreenText{},
|
||||
UsernameChangeDone: domain.UsernameChangeDoneScreenText{},
|
||||
InitPassword: domain.InitPasswordScreenText{},
|
||||
InitPasswordDone: domain.InitPasswordDoneScreenText{},
|
||||
EmailVerification: domain.EmailVerificationScreenText{},
|
||||
EmailVerificationDone: domain.EmailVerificationDoneScreenText{},
|
||||
InitUser: domain.InitializeUserScreenText{},
|
||||
InitUserDone: domain.InitializeUserDoneScreenText{},
|
||||
InitMFAPrompt: domain.InitMFAPromptScreenText{},
|
||||
InitMFAOTP: domain.InitMFAOTPScreenText{},
|
||||
InitMFAU2F: domain.InitMFAU2FScreenText{},
|
||||
InitMFADone: domain.InitMFADoneScreenText{},
|
||||
MFAProvider: domain.MFAProvidersText{},
|
||||
VerifyMFAOTP: domain.VerifyMFAOTPScreenText{},
|
||||
VerifyMFAU2F: domain.VerifyMFAU2FScreenText{},
|
||||
Passwordless: domain.PasswordlessScreenText{},
|
||||
PasswordlessPrompt: domain.PasswordlessPromptScreenText{},
|
||||
PasswordlessRegistration: domain.PasswordlessRegistrationScreenText{},
|
||||
PasswordlessRegistrationDone: domain.PasswordlessRegistrationDoneScreenText{},
|
||||
PasswordChange: domain.PasswordChangeScreenText{},
|
||||
PasswordChangeDone: domain.PasswordChangeDoneScreenText{},
|
||||
PasswordResetDone: domain.PasswordResetDoneScreenText{},
|
||||
RegisterOption: domain.RegistrationOptionScreenText{},
|
||||
RegistrationUser: domain.RegistrationUserScreenText{},
|
||||
ExternalRegistrationUserOverview: domain.ExternalRegistrationUserOverviewScreenText{},
|
||||
RegistrationOrg: domain.RegistrationOrgScreenText{},
|
||||
LinkingUsersDone: domain.LinkingUserDoneScreenText{},
|
||||
ExternalNotFoundOption: domain.ExternalUserNotFoundScreenText{},
|
||||
LoginSuccess: domain.SuccessLoginScreenText{},
|
||||
LogoutDone: domain.LogoutDoneScreenText{},
|
||||
Footer: domain.FooterText{},
|
||||
RegistrationOrg: domain.RegistrationOrgScreenText{},
|
||||
LinkingUsersDone: domain.LinkingUserDoneScreenText{},
|
||||
ExternalNotFoundOption: domain.ExternalUserNotFoundScreenText{},
|
||||
LoginSuccess: domain.SuccessLoginScreenText{},
|
||||
LogoutDone: domain.LogoutDoneScreenText{},
|
||||
Footer: domain.FooterText{},
|
||||
},
|
||||
},
|
||||
res: res{
|
||||
@@ -4320,6 +4336,11 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, "Description", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextSetEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, "DescriptionClose", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextSetEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, "NextButtonText", language.English,
|
||||
@@ -5411,6 +5432,11 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextRemovedEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextRemovedEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, language.English,
|
||||
@@ -6504,6 +6530,11 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, "Description", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextSetEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, "DescriptionClose", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
iam.NewCustomTextSetEvent(context.Background(),
|
||||
&iam.NewAggregate().Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, "NextButtonText", language.English,
|
||||
@@ -7141,6 +7172,7 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
|
||||
PasswordlessRegistrationDone: domain.PasswordlessRegistrationDoneScreenText{
|
||||
Title: "Title",
|
||||
Description: "Description",
|
||||
DescriptionClose: "DescriptionClose",
|
||||
NextButtonText: "NextButtonText",
|
||||
CancelButtonText: "CancelButtonText",
|
||||
},
|
||||
|
||||
@@ -701,6 +701,11 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, "Description", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextSetEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, "DescriptionClose", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextSetEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, "NextButtonText", language.English,
|
||||
@@ -1339,6 +1344,7 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
PasswordlessRegistrationDone: domain.PasswordlessRegistrationDoneScreenText{
|
||||
Title: "Title",
|
||||
Description: "Description",
|
||||
DescriptionClose: "DescriptionClose",
|
||||
NextButtonText: "NextButtonText",
|
||||
CancelButtonText: "CancelButtonText",
|
||||
},
|
||||
@@ -2100,6 +2106,11 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, "Description", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextSetEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, "DescriptionClose", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextSetEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, "NextButtonText", language.English,
|
||||
@@ -3193,6 +3204,11 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextRemovedEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextRemovedEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, language.English,
|
||||
@@ -3661,41 +3677,41 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
ctx: context.Background(),
|
||||
resourceOwner: "org1",
|
||||
config: &domain.CustomLoginText{
|
||||
Language: language.English,
|
||||
SelectAccount: domain.SelectAccountScreenText{},
|
||||
Login: domain.LoginScreenText{},
|
||||
Password: domain.PasswordScreenText{},
|
||||
UsernameChange: domain.UsernameChangeScreenText{},
|
||||
UsernameChangeDone: domain.UsernameChangeDoneScreenText{},
|
||||
InitPassword: domain.InitPasswordScreenText{},
|
||||
InitPasswordDone: domain.InitPasswordDoneScreenText{},
|
||||
EmailVerification: domain.EmailVerificationScreenText{},
|
||||
EmailVerificationDone: domain.EmailVerificationDoneScreenText{},
|
||||
InitUser: domain.InitializeUserScreenText{},
|
||||
InitUserDone: domain.InitializeUserDoneScreenText{},
|
||||
InitMFAPrompt: domain.InitMFAPromptScreenText{},
|
||||
InitMFAOTP: domain.InitMFAOTPScreenText{},
|
||||
InitMFAU2F: domain.InitMFAU2FScreenText{},
|
||||
InitMFADone: domain.InitMFADoneScreenText{},
|
||||
MFAProvider: domain.MFAProvidersText{},
|
||||
VerifyMFAOTP: domain.VerifyMFAOTPScreenText{},
|
||||
VerifyMFAU2F: domain.VerifyMFAU2FScreenText{},
|
||||
Passwordless: domain.PasswordlessScreenText{},
|
||||
PasswordlessPrompt: domain.PasswordlessPromptScreenText{},
|
||||
PasswordlessRegistration: domain.PasswordlessRegistrationScreenText{},
|
||||
PasswordlessRegistrationDone: domain.PasswordlessRegistrationDoneScreenText{},
|
||||
PasswordChange: domain.PasswordChangeScreenText{},
|
||||
PasswordChangeDone: domain.PasswordChangeDoneScreenText{},
|
||||
PasswordResetDone: domain.PasswordResetDoneScreenText{},
|
||||
RegisterOption: domain.RegistrationOptionScreenText{},
|
||||
Language: language.English,
|
||||
SelectAccount: domain.SelectAccountScreenText{},
|
||||
Login: domain.LoginScreenText{},
|
||||
Password: domain.PasswordScreenText{},
|
||||
UsernameChange: domain.UsernameChangeScreenText{},
|
||||
UsernameChangeDone: domain.UsernameChangeDoneScreenText{},
|
||||
InitPassword: domain.InitPasswordScreenText{},
|
||||
InitPasswordDone: domain.InitPasswordDoneScreenText{},
|
||||
EmailVerification: domain.EmailVerificationScreenText{},
|
||||
EmailVerificationDone: domain.EmailVerificationDoneScreenText{},
|
||||
InitUser: domain.InitializeUserScreenText{},
|
||||
InitUserDone: domain.InitializeUserDoneScreenText{},
|
||||
InitMFAPrompt: domain.InitMFAPromptScreenText{},
|
||||
InitMFAOTP: domain.InitMFAOTPScreenText{},
|
||||
InitMFAU2F: domain.InitMFAU2FScreenText{},
|
||||
InitMFADone: domain.InitMFADoneScreenText{},
|
||||
MFAProvider: domain.MFAProvidersText{},
|
||||
VerifyMFAOTP: domain.VerifyMFAOTPScreenText{},
|
||||
VerifyMFAU2F: domain.VerifyMFAU2FScreenText{},
|
||||
Passwordless: domain.PasswordlessScreenText{},
|
||||
PasswordlessPrompt: domain.PasswordlessPromptScreenText{},
|
||||
PasswordlessRegistration: domain.PasswordlessRegistrationScreenText{},
|
||||
PasswordlessRegistrationDone: domain.PasswordlessRegistrationDoneScreenText{},
|
||||
PasswordChange: domain.PasswordChangeScreenText{},
|
||||
PasswordChangeDone: domain.PasswordChangeDoneScreenText{},
|
||||
PasswordResetDone: domain.PasswordResetDoneScreenText{},
|
||||
RegisterOption: domain.RegistrationOptionScreenText{},
|
||||
ExternalRegistrationUserOverview: domain.ExternalRegistrationUserOverviewScreenText{},
|
||||
RegistrationUser: domain.RegistrationUserScreenText{},
|
||||
RegistrationOrg: domain.RegistrationOrgScreenText{},
|
||||
LinkingUsersDone: domain.LinkingUserDoneScreenText{},
|
||||
ExternalNotFoundOption: domain.ExternalUserNotFoundScreenText{},
|
||||
LoginSuccess: domain.SuccessLoginScreenText{},
|
||||
LogoutDone: domain.LogoutDoneScreenText{},
|
||||
Footer: domain.FooterText{},
|
||||
RegistrationUser: domain.RegistrationUserScreenText{},
|
||||
RegistrationOrg: domain.RegistrationOrgScreenText{},
|
||||
LinkingUsersDone: domain.LinkingUserDoneScreenText{},
|
||||
ExternalNotFoundOption: domain.ExternalUserNotFoundScreenText{},
|
||||
LoginSuccess: domain.SuccessLoginScreenText{},
|
||||
LogoutDone: domain.LogoutDoneScreenText{},
|
||||
Footer: domain.FooterText{},
|
||||
},
|
||||
},
|
||||
res: res{
|
||||
@@ -4340,6 +4356,11 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, "Description", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextSetEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, "DescriptionClose", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextSetEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, "NextButtonText", language.English,
|
||||
@@ -5430,6 +5451,11 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextRemovedEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextRemovedEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, language.English,
|
||||
@@ -6523,6 +6549,11 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescription, "Description", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextSetEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneDescriptionClose, "DescriptionClose", language.English,
|
||||
),
|
||||
),
|
||||
eventFromEventPusher(
|
||||
org.NewCustomTextSetEvent(context.Background(),
|
||||
&org.NewAggregate("org1", "org1").Aggregate, domain.LoginCustomText, domain.LoginKeyPasswordlessRegistrationDoneNextButtonText, "NextButtonText", language.English,
|
||||
@@ -7161,6 +7192,7 @@ func TestCommandSide_SetCustomOrgLoginText(t *testing.T) {
|
||||
PasswordlessRegistrationDone: domain.PasswordlessRegistrationDoneScreenText{
|
||||
Title: "Title",
|
||||
Description: "Description",
|
||||
DescriptionClose: "DescriptionClose",
|
||||
NextButtonText: "NextButtonText",
|
||||
CancelButtonText: "CancelButtonText",
|
||||
},
|
||||
|
||||
@@ -82,7 +82,7 @@ func (c *Commands) HumanAddU2FSetup(ctx context.Context, userID, resourceowner s
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
addWebAuthN, userAgg, webAuthN, err := c.addHumanWebAuthN(ctx, userID, resourceowner, isLoginUI, u2fTokens)
|
||||
addWebAuthN, userAgg, webAuthN, err := c.addHumanWebAuthN(ctx, userID, resourceowner, isLoginUI, u2fTokens, domain.AuthenticatorAttachmentUnspecified)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -103,12 +103,12 @@ func (c *Commands) HumanAddU2FSetup(ctx context.Context, userID, resourceowner s
|
||||
return createdWebAuthN, nil
|
||||
}
|
||||
|
||||
func (c *Commands) HumanAddPasswordlessSetup(ctx context.Context, userID, resourceowner string, isLoginUI bool) (*domain.WebAuthNToken, error) {
|
||||
func (c *Commands) HumanAddPasswordlessSetup(ctx context.Context, userID, resourceowner string, isLoginUI bool, authenticatorPlatform domain.AuthenticatorAttachment) (*domain.WebAuthNToken, error) {
|
||||
passwordlessTokens, err := c.getHumanPasswordlessTokens(ctx, userID, resourceowner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
addWebAuthN, userAgg, webAuthN, err := c.addHumanWebAuthN(ctx, userID, resourceowner, isLoginUI, passwordlessTokens)
|
||||
addWebAuthN, userAgg, webAuthN, err := c.addHumanWebAuthN(ctx, userID, resourceowner, isLoginUI, passwordlessTokens, authenticatorPlatform)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -129,15 +129,15 @@ func (c *Commands) HumanAddPasswordlessSetup(ctx context.Context, userID, resour
|
||||
return createdWebAuthN, nil
|
||||
}
|
||||
|
||||
func (c *Commands) HumanAddPasswordlessSetupInitCode(ctx context.Context, userID, resourceowner, codeID, verificationCode string) (*domain.WebAuthNToken, error) {
|
||||
func (c *Commands) HumanAddPasswordlessSetupInitCode(ctx context.Context, userID, resourceowner, codeID, verificationCode string, preferredPlatformType domain.AuthenticatorAttachment) (*domain.WebAuthNToken, error) {
|
||||
err := c.humanVerifyPasswordlessInitCode(ctx, userID, resourceowner, codeID, verificationCode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.HumanAddPasswordlessSetup(ctx, userID, resourceowner, true)
|
||||
return c.HumanAddPasswordlessSetup(ctx, userID, resourceowner, true, preferredPlatformType)
|
||||
}
|
||||
|
||||
func (c *Commands) addHumanWebAuthN(ctx context.Context, userID, resourceowner string, isLoginUI bool, tokens []*domain.WebAuthNToken) (*HumanWebAuthNWriteModel, *eventstore.Aggregate, *domain.WebAuthNToken, error) {
|
||||
func (c *Commands) addHumanWebAuthN(ctx context.Context, userID, resourceowner string, isLoginUI bool, tokens []*domain.WebAuthNToken, authenticatorPlatform domain.AuthenticatorAttachment) (*HumanWebAuthNWriteModel, *eventstore.Aggregate, *domain.WebAuthNToken, error) {
|
||||
if userID == "" {
|
||||
return nil, nil, nil, caos_errs.ThrowPreconditionFailed(nil, "COMMAND-3M0od", "Errors.IDMissing")
|
||||
}
|
||||
@@ -157,7 +157,7 @@ func (c *Commands) addHumanWebAuthN(ctx context.Context, userID, resourceowner s
|
||||
if accountName == "" {
|
||||
accountName = user.EmailAddress
|
||||
}
|
||||
webAuthN, err := c.webauthn.BeginRegistration(user, accountName, domain.AuthenticatorAttachmentUnspecified, domain.UserVerificationRequirementDiscouraged, isLoginUI, tokens...)
|
||||
webAuthN, err := c.webauthn.BeginRegistration(user, accountName, authenticatorPlatform, domain.UserVerificationRequirementDiscouraged, isLoginUI, tokens...)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
@@ -498,6 +498,9 @@ func (c *Commands) HumanAddPasswordlessInitCode(ctx context.Context, userID, res
|
||||
|
||||
func (c *Commands) HumanSendPasswordlessInitCode(ctx context.Context, userID, resourceOwner string) (*domain.PasswordlessInitCode, error) {
|
||||
codeEvent, initCode, code, err := c.humanAddPasswordlessInitCode(ctx, userID, resourceOwner, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pushedEvents, err := c.eventstore.PushEvents(ctx, codeEvent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user