Skip to content

Commit

Permalink
fix: refresh is always false when session exists
Browse files Browse the repository at this point in the history
Closes #2341
  • Loading branch information
aeneasr committed Mar 28, 2022
1 parent 9c9477a commit d3436d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions selfservice/flow/login/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ func (h *Handler) NewLoginFlow(w http.ResponseWriter, r *http.Request, ft flow.T
return nil, errors.WithStack(ErrSessionRequiredForHigherAAL)
}

// We are setting refresh to false if no session exists.
f.Refresh = false

goto preLoginHook
} else if err != nil {
// Some other error happened - return that one.
Expand Down
2 changes: 1 addition & 1 deletion selfservice/flow/login/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func TestFlowLifecycle(t *testing.T) {
t.Run("case=does not set forced flag on unauthenticated request with refresh=true", func(t *testing.T) {
res, body := initFlow(t, url.Values{"refresh": {"true"}}, true)
assert.Contains(t, res.Request.URL.String(), login.RouteInitAPIFlow)
assertion(body, true, true)
assertion(body, false, true)
})

t.Run("case=does not set forced flag on authenticated request without refresh=true", func(t *testing.T) {
Expand Down

0 comments on commit d3436d7

Please sign in to comment.