From 890f99a0aaab1d6d7423910f4894b1c6d858f7a4 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:56:40 +0200 Subject: [PATCH 1/7] feat: change `method=profile:back` to `screen=previous` BREAKING CHANGE: When using two-step registration, it was previously possible to send `method=profile:back` to get to the previous screen. This feature was not documented in the SDK API yet. Going forward, please instead use `screen=previous`. --- go.mod | 2 +- go.sum | 4 +- ...e_registration_flow_with_profile_method.go | 37 +++++++++++++++++++ ...e_registration_flow_with_profile_method.go | 37 +++++++++++++++++++ .../profile/.schema/registration.schema.json | 3 +- .../profile/.schema/settings.schema.json | 3 ++ .../strategy/profile/two_step_registration.go | 21 ++++++++--- spec/api.json | 4 ++ spec/swagger.json | 4 ++ 9 files changed, 106 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index fe40535547ea..043213cc7acc 100644 --- a/go.mod +++ b/go.mod @@ -70,7 +70,7 @@ require ( github.com/ory/jsonschema/v3 v3.0.8 github.com/ory/mail/v3 v3.0.0 github.com/ory/nosurf v1.2.7 - github.com/ory/x v0.0.655 + github.com/ory/x v0.0.656-0.20240924084701-ce6822d48829 github.com/peterhellberg/link v1.2.0 github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index f95bea93a9a7..60c01f878cb6 100644 --- a/go.sum +++ b/go.sum @@ -645,8 +645,8 @@ github.com/ory/pop/v6 v6.2.0 h1:hRFOGAOEHw91kUHQ32k5NHqCkcHrRou/romvrJP1w0E= github.com/ory/pop/v6 v6.2.0/go.mod h1:okVAYKGtgunD/wbW3NGhZTndJCS+6FqO+cA89rQ4doc= github.com/ory/sessions v1.2.2-0.20220110165800-b09c17334dc2 h1:zm6sDvHy/U9XrGpixwHiuAwpp0Ock6khSVHkrv6lQQU= github.com/ory/sessions v1.2.2-0.20220110165800-b09c17334dc2/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/ory/x v0.0.655 h1:P+uwq8GE2YoB9sEyo/8nxuPwdHzBvXE/Xnkyujl7HeQ= -github.com/ory/x v0.0.655/go.mod h1:M+0EAXo7DT7Z2/Yrzvh4mgxOoV1fGI1jOKyAJ72d4Qs= +github.com/ory/x v0.0.656-0.20240924084701-ce6822d48829 h1:y9BraWW+kjp/yYeuRLKBu951WVaLe2Z7lTqb4mPMlFk= +github.com/ory/x v0.0.656-0.20240924084701-ce6822d48829/go.mod h1:M+0EAXo7DT7Z2/Yrzvh4mgxOoV1fGI1jOKyAJ72d4Qs= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= 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..78b09bcb5594 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 @@ -17,6 +17,8 @@ import ( // UpdateRegistrationFlowWithProfileMethod Update Registration Flow with Profile Method type UpdateRegistrationFlowWithProfileMethod struct { + // Action Can be \"back\" to navigate back to the previous step. + Action *string `json:"action,omitempty"` // The Anti-CSRF Token This token is only required when performing browser flows. CsrfToken *string `json:"csrf_token,omitempty"` // Method Should be set to profile when trying to update a profile. @@ -48,6 +50,38 @@ func NewUpdateRegistrationFlowWithProfileMethodWithDefaults() *UpdateRegistratio return &this } +// GetAction returns the Action field value if set, zero value otherwise. +func (o *UpdateRegistrationFlowWithProfileMethod) GetAction() string { + if o == nil || o.Action == nil { + var ret string + return ret + } + return *o.Action +} + +// GetActionOk returns a tuple with the Action field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegistrationFlowWithProfileMethod) GetActionOk() (*string, bool) { + if o == nil || o.Action == nil { + return nil, false + } + return o.Action, true +} + +// HasAction returns a boolean if a field has been set. +func (o *UpdateRegistrationFlowWithProfileMethod) HasAction() bool { + if o != nil && o.Action != nil { + return true + } + + return false +} + +// SetAction gets a reference to the given string and assigns it to the Action field. +func (o *UpdateRegistrationFlowWithProfileMethod) SetAction(v string) { + o.Action = &v +} + // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithProfileMethod) GetCsrfToken() string { if o == nil || o.CsrfToken == nil { @@ -194,6 +228,9 @@ func (o *UpdateRegistrationFlowWithProfileMethod) SetTransientPayload(v map[stri func (o UpdateRegistrationFlowWithProfileMethod) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} + if o.Action != nil { + toSerialize["action"] = o.Action + } if o.CsrfToken != nil { toSerialize["csrf_token"] = o.CsrfToken } 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..78b09bcb5594 100644 --- a/internal/httpclient/model_update_registration_flow_with_profile_method.go +++ b/internal/httpclient/model_update_registration_flow_with_profile_method.go @@ -17,6 +17,8 @@ import ( // UpdateRegistrationFlowWithProfileMethod Update Registration Flow with Profile Method type UpdateRegistrationFlowWithProfileMethod struct { + // Action Can be \"back\" to navigate back to the previous step. + Action *string `json:"action,omitempty"` // The Anti-CSRF Token This token is only required when performing browser flows. CsrfToken *string `json:"csrf_token,omitempty"` // Method Should be set to profile when trying to update a profile. @@ -48,6 +50,38 @@ func NewUpdateRegistrationFlowWithProfileMethodWithDefaults() *UpdateRegistratio return &this } +// GetAction returns the Action field value if set, zero value otherwise. +func (o *UpdateRegistrationFlowWithProfileMethod) GetAction() string { + if o == nil || o.Action == nil { + var ret string + return ret + } + return *o.Action +} + +// GetActionOk returns a tuple with the Action field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegistrationFlowWithProfileMethod) GetActionOk() (*string, bool) { + if o == nil || o.Action == nil { + return nil, false + } + return o.Action, true +} + +// HasAction returns a boolean if a field has been set. +func (o *UpdateRegistrationFlowWithProfileMethod) HasAction() bool { + if o != nil && o.Action != nil { + return true + } + + return false +} + +// SetAction gets a reference to the given string and assigns it to the Action field. +func (o *UpdateRegistrationFlowWithProfileMethod) SetAction(v string) { + o.Action = &v +} + // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithProfileMethod) GetCsrfToken() string { if o == nil || o.CsrfToken == nil { @@ -194,6 +228,9 @@ func (o *UpdateRegistrationFlowWithProfileMethod) SetTransientPayload(v map[stri func (o UpdateRegistrationFlowWithProfileMethod) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} + if o.Action != nil { + toSerialize["action"] = o.Action + } if o.CsrfToken != nil { toSerialize["csrf_token"] = o.CsrfToken } diff --git a/selfservice/strategy/profile/.schema/registration.schema.json b/selfservice/strategy/profile/.schema/registration.schema.json index 4a4d5dba16c4..727b8f86c7d5 100644 --- a/selfservice/strategy/profile/.schema/registration.schema.json +++ b/selfservice/strategy/profile/.schema/registration.schema.json @@ -12,7 +12,8 @@ "screen": { "type": "string", "enum": [ - "credential-selection" + "credential-selection", + "previous" ] }, "method": { diff --git a/selfservice/strategy/profile/.schema/settings.schema.json b/selfservice/strategy/profile/.schema/settings.schema.json index 5ae4ad70d94a..90246cbde523 100644 --- a/selfservice/strategy/profile/.schema/settings.schema.json +++ b/selfservice/strategy/profile/.schema/settings.schema.json @@ -13,6 +13,9 @@ "csrf_token": { "type": "string" }, + "action": { + "type": "string" + }, "transient_payload": { "type": "object", "additionalProperties": true diff --git a/selfservice/strategy/profile/two_step_registration.go b/selfservice/strategy/profile/two_step_registration.go index 800d04c1c40f..c0eb76cf941d 100644 --- a/selfservice/strategy/profile/two_step_registration.go +++ b/selfservice/strategy/profile/two_step_registration.go @@ -9,6 +9,8 @@ import ( "encoding/json" "net/http" + "github.com/ory/x/otelx/semconv" + "go.opentelemetry.io/otel/attribute" "github.com/ory/x/otelx" @@ -86,6 +88,11 @@ type updateRegistrationFlowWithProfileMethod struct { // required: true Method string `json:"method"` + // Action + // + // Can be "back" to navigate back to the previous step. + Action string `json:"action"` + // Screen requests navigation to a previous screen. // // This must be set to credential-selection to go back to the credential @@ -133,12 +140,16 @@ func (s *Strategy) Register(w http.ResponseWriter, r *http.Request, regFlow *reg params.Method = "profile" } - switch params.Method { - case "profile": + if params.Method == "profile" { return s.displayStepTwoNodes(ctx, w, r, regFlow, i, params) - case "profile:back": + } 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" { return s.displayStepOneNodes(ctx, w, r, regFlow, params) } + // Default case span.SetAttributes(attribute.String("not_responsible_reason", "method mismatch")) return flow.ErrStrategyNotResponsible @@ -194,8 +205,8 @@ func (s *Strategy) displayStepTwoNodes(ctx context.Context, w http.ResponseWrite regFlow.UI.Messages.Add(text.NewInfoSelfServiceChooseCredentials()) regFlow.UI.Nodes.Append(node.NewInputField( - "method", - "profile:back", + "action", + "back", node.ProfileGroup, node.InputAttributeTypeSubmit, ).WithMetaLabel(text.NewInfoRegistrationBack())) diff --git a/spec/api.json b/spec/api.json index f0331bee92e5..e56ce68762e8 100644 --- a/spec/api.json +++ b/spec/api.json @@ -3235,6 +3235,10 @@ "updateRegistrationFlowWithProfileMethod": { "description": "Update Registration Flow with Profile Method", "properties": { + "action": { + "description": "Action\n\nCan be \"back\" to navigate back to the previous step.", + "type": "string" + }, "csrf_token": { "description": "The Anti-CSRF Token\n\nThis token is only required when performing browser flows.", "type": "string" diff --git a/spec/swagger.json b/spec/swagger.json index 12ba5f44a9e6..b277ecf2ad29 100755 --- a/spec/swagger.json +++ b/spec/swagger.json @@ -6219,6 +6219,10 @@ "method" ], "properties": { + "action": { + "description": "Action\n\nCan be \"back\" to navigate back to the previous step.", + "type": "string" + }, "csrf_token": { "description": "The Anti-CSRF Token\n\nThis token is only required when performing browser flows.", "type": "string" From 1d882c55827473557b356816d8f5b0d8a0e3a1fd Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:57:35 +0200 Subject: [PATCH 2/7] chore: synchronize workspaces --- ...e_registration_flow_with_profile_method.go | 37 ------------------- ...e_registration_flow_with_profile_method.go | 37 ------------------- .../strategy/profile/two_step_registration.go | 5 --- spec/api.json | 4 -- spec/swagger.json | 4 -- 5 files changed, 87 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 78b09bcb5594..221e5ea82ada 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 @@ -17,8 +17,6 @@ import ( // UpdateRegistrationFlowWithProfileMethod Update Registration Flow with Profile Method type UpdateRegistrationFlowWithProfileMethod struct { - // Action Can be \"back\" to navigate back to the previous step. - Action *string `json:"action,omitempty"` // The Anti-CSRF Token This token is only required when performing browser flows. CsrfToken *string `json:"csrf_token,omitempty"` // Method Should be set to profile when trying to update a profile. @@ -50,38 +48,6 @@ func NewUpdateRegistrationFlowWithProfileMethodWithDefaults() *UpdateRegistratio return &this } -// GetAction returns the Action field value if set, zero value otherwise. -func (o *UpdateRegistrationFlowWithProfileMethod) GetAction() string { - if o == nil || o.Action == nil { - var ret string - return ret - } - return *o.Action -} - -// GetActionOk returns a tuple with the Action field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UpdateRegistrationFlowWithProfileMethod) GetActionOk() (*string, bool) { - if o == nil || o.Action == nil { - return nil, false - } - return o.Action, true -} - -// HasAction returns a boolean if a field has been set. -func (o *UpdateRegistrationFlowWithProfileMethod) HasAction() bool { - if o != nil && o.Action != nil { - return true - } - - return false -} - -// SetAction gets a reference to the given string and assigns it to the Action field. -func (o *UpdateRegistrationFlowWithProfileMethod) SetAction(v string) { - o.Action = &v -} - // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithProfileMethod) GetCsrfToken() string { if o == nil || o.CsrfToken == nil { @@ -228,9 +194,6 @@ func (o *UpdateRegistrationFlowWithProfileMethod) SetTransientPayload(v map[stri func (o UpdateRegistrationFlowWithProfileMethod) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Action != nil { - toSerialize["action"] = o.Action - } if o.CsrfToken != nil { toSerialize["csrf_token"] = o.CsrfToken } 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 78b09bcb5594..221e5ea82ada 100644 --- a/internal/httpclient/model_update_registration_flow_with_profile_method.go +++ b/internal/httpclient/model_update_registration_flow_with_profile_method.go @@ -17,8 +17,6 @@ import ( // UpdateRegistrationFlowWithProfileMethod Update Registration Flow with Profile Method type UpdateRegistrationFlowWithProfileMethod struct { - // Action Can be \"back\" to navigate back to the previous step. - Action *string `json:"action,omitempty"` // The Anti-CSRF Token This token is only required when performing browser flows. CsrfToken *string `json:"csrf_token,omitempty"` // Method Should be set to profile when trying to update a profile. @@ -50,38 +48,6 @@ func NewUpdateRegistrationFlowWithProfileMethodWithDefaults() *UpdateRegistratio return &this } -// GetAction returns the Action field value if set, zero value otherwise. -func (o *UpdateRegistrationFlowWithProfileMethod) GetAction() string { - if o == nil || o.Action == nil { - var ret string - return ret - } - return *o.Action -} - -// GetActionOk returns a tuple with the Action field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *UpdateRegistrationFlowWithProfileMethod) GetActionOk() (*string, bool) { - if o == nil || o.Action == nil { - return nil, false - } - return o.Action, true -} - -// HasAction returns a boolean if a field has been set. -func (o *UpdateRegistrationFlowWithProfileMethod) HasAction() bool { - if o != nil && o.Action != nil { - return true - } - - return false -} - -// SetAction gets a reference to the given string and assigns it to the Action field. -func (o *UpdateRegistrationFlowWithProfileMethod) SetAction(v string) { - o.Action = &v -} - // GetCsrfToken returns the CsrfToken field value if set, zero value otherwise. func (o *UpdateRegistrationFlowWithProfileMethod) GetCsrfToken() string { if o == nil || o.CsrfToken == nil { @@ -228,9 +194,6 @@ func (o *UpdateRegistrationFlowWithProfileMethod) SetTransientPayload(v map[stri func (o UpdateRegistrationFlowWithProfileMethod) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Action != nil { - toSerialize["action"] = o.Action - } if o.CsrfToken != nil { toSerialize["csrf_token"] = o.CsrfToken } diff --git a/selfservice/strategy/profile/two_step_registration.go b/selfservice/strategy/profile/two_step_registration.go index c0eb76cf941d..f29f9b45a4bd 100644 --- a/selfservice/strategy/profile/two_step_registration.go +++ b/selfservice/strategy/profile/two_step_registration.go @@ -88,11 +88,6 @@ type updateRegistrationFlowWithProfileMethod struct { // required: true Method string `json:"method"` - // Action - // - // Can be "back" to navigate back to the previous step. - Action string `json:"action"` - // Screen requests navigation to a previous screen. // // This must be set to credential-selection to go back to the credential diff --git a/spec/api.json b/spec/api.json index e56ce68762e8..f0331bee92e5 100644 --- a/spec/api.json +++ b/spec/api.json @@ -3235,10 +3235,6 @@ "updateRegistrationFlowWithProfileMethod": { "description": "Update Registration Flow with Profile Method", "properties": { - "action": { - "description": "Action\n\nCan be \"back\" to navigate back to the previous step.", - "type": "string" - }, "csrf_token": { "description": "The Anti-CSRF Token\n\nThis token is only required when performing browser flows.", "type": "string" diff --git a/spec/swagger.json b/spec/swagger.json index b277ecf2ad29..12ba5f44a9e6 100755 --- a/spec/swagger.json +++ b/spec/swagger.json @@ -6219,10 +6219,6 @@ "method" ], "properties": { - "action": { - "description": "Action\n\nCan be \"back\" to navigate back to the previous step.", - "type": "string" - }, "csrf_token": { "description": "The Anti-CSRF Token\n\nThis token is only required when performing browser flows.", "type": "string" 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 3/7] 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.", From 498f0306ce46ff7a2538d53d306529b97e2f3fa1 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:01:23 +0200 Subject: [PATCH 4/7] chore: synchronize workspaces --- .../profiles/two-steps/registration/password.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/cypress/integration/profiles/two-steps/registration/password.spec.ts b/test/e2e/cypress/integration/profiles/two-steps/registration/password.spec.ts index 975306f8c857..8621b7a69483 100644 --- a/test/e2e/cypress/integration/profiles/two-steps/registration/password.spec.ts +++ b/test/e2e/cypress/integration/profiles/two-steps/registration/password.spec.ts @@ -46,7 +46,7 @@ context("Registration success with two-step signup", () => { cy.get('[name="method"][value="profile"]').click() // navigate back, fill traits again - cy.get('[name="method"][value="profile:back"]').click() + cy.get('[name="screen"][value="previous"]').click() cy.get('input[name="traits.email"]').type( "{selectall}{backspace}" + email, ) From 6575f64fcc3ce5ee46cf8673b37960579bb0a787 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:04:41 +0200 Subject: [PATCH 5/7] chore: synchronize workspaces --- selfservice/strategy/profile/two_step_registration.go | 1 + 1 file changed, 1 insertion(+) diff --git a/selfservice/strategy/profile/two_step_registration.go b/selfservice/strategy/profile/two_step_registration.go index 913bacdda139..24865b6c7773 100644 --- a/selfservice/strategy/profile/two_step_registration.go +++ b/selfservice/strategy/profile/two_step_registration.go @@ -72,6 +72,7 @@ func (s *Strategy) PopulateRegistrationMethod(r *http.Request, f *registration.F type RegistrationScreen string const ( + //lint:ignore G101 This is not a real credential. RegistrationScreenCredentialSelection RegistrationScreen = "credential-selection" RegistrationScreenPrevious RegistrationScreen = "previous" ) From 50f0fe1cca00be03822449e70c9dfef5b9723cb0 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Wed, 25 Sep 2024 10:42:00 +0200 Subject: [PATCH 6/7] chore: synchronize workspaces --- selfservice/strategy/profile/two_step_registration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selfservice/strategy/profile/two_step_registration.go b/selfservice/strategy/profile/two_step_registration.go index 24865b6c7773..60ebfeb0b081 100644 --- a/selfservice/strategy/profile/two_step_registration.go +++ b/selfservice/strategy/profile/two_step_registration.go @@ -72,7 +72,7 @@ func (s *Strategy) PopulateRegistrationMethod(r *http.Request, f *registration.F type RegistrationScreen string const ( - //lint:ignore G101 This is not a real credential. + //nolint:gosec (G101): This is not a real credential. RegistrationScreenCredentialSelection RegistrationScreen = "credential-selection" RegistrationScreenPrevious RegistrationScreen = "previous" ) @@ -206,8 +206,8 @@ func (s *Strategy) displayStepTwoNodes(ctx context.Context, w http.ResponseWrite regFlow.UI.Messages.Add(text.NewInfoSelfServiceChooseCredentials()) regFlow.UI.Nodes.Append(node.NewInputField( - "action", - "back", + "screen", + "previous", node.ProfileGroup, node.InputAttributeTypeSubmit, ).WithMetaLabel(text.NewInfoRegistrationBack())) From d52215f9aeed5964bfc6970b76b051c2792577d1 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:24:10 +0200 Subject: [PATCH 7/7] chore: synchronize workspaces --- Makefile | 4 ++-- selfservice/strategy/profile/two_step_registration.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4924072c8111..05c9c0de9760 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ docs/swagger: npx @redocly/openapi-cli preview-docs spec/swagger.json .bin/golangci-lint: Makefile - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -d -b .bin v1.59.1 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -d -b .bin v1.61.0 .bin/hydra: Makefile bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) -d -b .bin hydra v2.2.0-rc.3 @@ -60,7 +60,7 @@ docs/swagger: .bin/buf: Makefile curl -sSL \ "https://github.com/bufbuild/buf/releases/download/v1.39.0/buf-$(shell uname -s)-$(shell uname -m).tar.gz" | \ - tar -xvzf - -C ".bin/" --strip-components=2 buf/bin/buf buf/bin/protoc-gen-buf-breaking buf/bin/protoc-gen-buf-lint + tar -xvzf - -C ".bin/" --strip-components=2 buf/bin/buf buf/bin/protoc-gen-buf-breaking buf/bin/protoc-gen-buf-lint touch -a -m .bin/buf .PHONY: lint diff --git a/selfservice/strategy/profile/two_step_registration.go b/selfservice/strategy/profile/two_step_registration.go index 60ebfeb0b081..d6f037a54a92 100644 --- a/selfservice/strategy/profile/two_step_registration.go +++ b/selfservice/strategy/profile/two_step_registration.go @@ -72,7 +72,7 @@ func (s *Strategy) PopulateRegistrationMethod(r *http.Request, f *registration.F type RegistrationScreen string const ( - //nolint:gosec (G101): This is not a real credential. + //nolint:gosec // not a credential RegistrationScreenCredentialSelection RegistrationScreen = "credential-selection" RegistrationScreenPrevious RegistrationScreen = "previous" )