Skip to content

Commit

Permalink
fix: incorrect if switch in previous sceen case in two step registration
Browse files Browse the repository at this point in the history
Closes #374
  • Loading branch information
aeneasr committed Mar 4, 2025
1 parent bb63a65 commit 56be075
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions selfservice/strategy/profile/two_step_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,22 @@ func (s *Strategy) Register(w http.ResponseWriter, r *http.Request, regFlow *reg
return s.handleRegistrationError(r, regFlow, params, err)
}

if params.Method == "profile" || params.Screen == RegistrationScreenCredentialSelection {
return s.displayStepTwoNodes(ctx, w, r, regFlow, i, params)
if params.Method == "profile" || len(params.Screen) > 0 {
switch params.Screen {
case RegistrationScreenCredentialSelection:
return s.displayStepOneNodes(ctx, w, r, regFlow, params)
case RegistrationScreenPrevious:
return s.displayStepTwoNodes(ctx, w, r, regFlow, i, params)
default:
// FIXME In this scenario we are on the first step of the registration flow and the user clicked on "continue".
// FIXME The appropriate solution would be to also have `screen=credential-selection` available, but that
// FIXME is not the case right now. So instead, we fall back.
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 == RegistrationScreenPrevious {
return s.displayStepOneNodes(ctx, w, r, regFlow, params)
}

// Default case
Expand Down

0 comments on commit 56be075

Please sign in to comment.