From 13d11b88bc0573ba846f424df552894935a905c0 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:59:44 +0200 Subject: [PATCH] chore: synchronize workspaces --- ...e_registration_flow_with_profile_method.go | 2 +- ...e_registration_flow_with_profile_method.go | 2 +- .../strategy/profile/two_step_registration.go | 19 ++++++++++++------- spec/api.json | 9 +++++++-- spec/swagger.json | 9 +++++++-- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/internal/client-go/model_update_registration_flow_with_profile_method.go b/internal/client-go/model_update_registration_flow_with_profile_method.go index 221e5ea82ada..eb9572c1f431 100644 --- a/internal/client-go/model_update_registration_flow_with_profile_method.go +++ b/internal/client-go/model_update_registration_flow_with_profile_method.go @@ -21,7 +21,7 @@ type UpdateRegistrationFlowWithProfileMethod struct { CsrfToken *string `json:"csrf_token,omitempty"` // Method Should be set to profile when trying to update a profile. Method string `json:"method"` - // Screen requests navigation to a previous screen. This must be set to credential-selection to go back to the credential selection screen. + // Screen requests navigation to a previous screen. This must be set to credential-selection to go back to the credential selection screen. credential-selection RegistrationScreenCredentialSelection previous RegistrationScreenPrevious Screen *string `json:"screen,omitempty"` // Traits The identity's traits. Traits map[string]interface{} `json:"traits"` diff --git a/internal/httpclient/model_update_registration_flow_with_profile_method.go b/internal/httpclient/model_update_registration_flow_with_profile_method.go index 221e5ea82ada..eb9572c1f431 100644 --- a/internal/httpclient/model_update_registration_flow_with_profile_method.go +++ b/internal/httpclient/model_update_registration_flow_with_profile_method.go @@ -21,7 +21,7 @@ type UpdateRegistrationFlowWithProfileMethod struct { CsrfToken *string `json:"csrf_token,omitempty"` // Method Should be set to profile when trying to update a profile. Method string `json:"method"` - // Screen requests navigation to a previous screen. This must be set to credential-selection to go back to the credential selection screen. + // Screen requests navigation to a previous screen. This must be set to credential-selection to go back to the credential selection screen. credential-selection RegistrationScreenCredentialSelection previous RegistrationScreenPrevious Screen *string `json:"screen,omitempty"` // Traits The identity's traits. Traits map[string]interface{} `json:"traits"` diff --git a/selfservice/strategy/profile/two_step_registration.go b/selfservice/strategy/profile/two_step_registration.go index f29f9b45a4bd..913bacdda139 100644 --- a/selfservice/strategy/profile/two_step_registration.go +++ b/selfservice/strategy/profile/two_step_registration.go @@ -67,6 +67,15 @@ func (s *Strategy) PopulateRegistrationMethod(r *http.Request, f *registration.F return nil } +// The RegistrationScreen +// swagger:enum RegistrationScreen +type RegistrationScreen string + +const ( + RegistrationScreenCredentialSelection RegistrationScreen = "credential-selection" + RegistrationScreenPrevious RegistrationScreen = "previous" +) + // Update Registration Flow with Profile Method // // swagger:model updateRegistrationFlowWithProfileMethod @@ -94,7 +103,7 @@ type updateRegistrationFlowWithProfileMethod struct { // selection screen. // // required: false - Screen string `json:"screen" form:"screen"` + Screen RegistrationScreen `json:"screen" form:"screen"` // FlowIDRequestID is the flow ID. // @@ -131,17 +140,13 @@ func (s *Strategy) Register(w http.ResponseWriter, r *http.Request, regFlow *reg return s.handleRegistrationError(r, regFlow, params, err) } - if params.Screen == "credential-selection" { - params.Method = "profile" - } - - if params.Method == "profile" { + if params.Method == "profile" || params.Screen == RegistrationScreenCredentialSelection { return s.displayStepTwoNodes(ctx, w, r, regFlow, i, params) } else if params.Method == "profile:back" { // "profile:back" is kept for backwards compatibility. span.AddEvent(semconv.NewDeprecatedFeatureUsedEvent(ctx, "profile:back")) return s.displayStepOneNodes(ctx, w, r, regFlow, params) - } else if params.Screen == "previous" { + } else if params.Screen == RegistrationScreenPrevious { return s.displayStepOneNodes(ctx, w, r, regFlow, params) } diff --git a/spec/api.json b/spec/api.json index f0331bee92e5..2c03f420226f 100644 --- a/spec/api.json +++ b/spec/api.json @@ -3244,8 +3244,13 @@ "type": "string" }, "screen": { - "description": "Screen requests navigation to a previous screen.\n\nThis must be set to credential-selection to go back to the credential\nselection screen.", - "type": "string" + "description": "Screen requests navigation to a previous screen.\n\nThis must be set to credential-selection to go back to the credential\nselection screen.\ncredential-selection RegistrationScreenCredentialSelection\nprevious RegistrationScreenPrevious", + "enum": [ + "credential-selection", + "previous" + ], + "type": "string", + "x-go-enum-desc": "credential-selection RegistrationScreenCredentialSelection\nprevious RegistrationScreenPrevious" }, "traits": { "description": "Traits\n\nThe identity's traits.", diff --git a/spec/swagger.json b/spec/swagger.json index 12ba5f44a9e6..3085b3a054c4 100755 --- a/spec/swagger.json +++ b/spec/swagger.json @@ -6228,8 +6228,13 @@ "type": "string" }, "screen": { - "description": "Screen requests navigation to a previous screen.\n\nThis must be set to credential-selection to go back to the credential\nselection screen.", - "type": "string" + "description": "Screen requests navigation to a previous screen.\n\nThis must be set to credential-selection to go back to the credential\nselection screen.\ncredential-selection RegistrationScreenCredentialSelection\nprevious RegistrationScreenPrevious", + "type": "string", + "enum": [ + "credential-selection", + "previous" + ], + "x-go-enum-desc": "credential-selection RegistrationScreenCredentialSelection\nprevious RegistrationScreenPrevious" }, "traits": { "description": "Traits\n\nThe identity's traits.",