Skip to content

Commit

Permalink
fix: add continue with only for json browser requests (#4002)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Jul 16, 2024
1 parent def6225 commit e0a4010
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion selfservice/flow/login/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (e *HookExecutor) PostLoginHook(
"redirect_reason": "login successful",
})...)

if f.Type == flow.TypeBrowser {
if f.Type == flow.TypeBrowser && x.IsJSONRequest(r) {
f.AddContinueWith(flow.NewContinueWithRedirectBrowserTo(returnTo.String()))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
{
"attributes": {
"disabled": false,
"maxlength": 6,
"name": "totp_code",
"node_type": "input",
"required": true,
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/totp/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (s *Strategy) PopulateLoginMethod(r *http.Request, requestedAAL identity.Au
}

sr.UI.SetCSRF(s.d.GenerateCSRFToken(r))
sr.UI.SetNode(node.NewInputField("totp_code", "", node.TOTPGroup, node.InputAttributeTypeText, node.WithRequiredInputAttribute, node.WithMaxLengthInputAttribute(int(digits))).WithMetaLabel(text.NewInfoLoginTOTPLabel()))
sr.UI.SetNode(node.NewInputField("totp_code", "", node.TOTPGroup, node.InputAttributeTypeText, node.WithRequiredInputAttribute).WithMetaLabel(text.NewInfoLoginTOTPLabel()))
sr.UI.GetNodes().Append(node.NewInputField("method", s.ID(), node.TOTPGroup, node.InputAttributeTypeSubmit).WithMetaLabel(text.NewInfoLoginTOTP()))

return nil
Expand Down

0 comments on commit e0a4010

Please sign in to comment.