diff --git a/selfservice/flow/login/error.go b/selfservice/flow/login/error.go index a22a351f5231..67f873bf49ce 100644 --- a/selfservice/flow/login/error.go +++ b/selfservice/flow/login/error.go @@ -100,7 +100,7 @@ func (s *ErrorHandler) WriteFlowError(w http.ResponseWriter, r *http.Request, f return } - if err := sortNodes(f.UI.Nodes); err != nil { + if err := sortNodes(r.Context(), f.UI.Nodes); err != nil { s.forward(w, r, f, err) return } diff --git a/selfservice/flow/login/handler.go b/selfservice/flow/login/handler.go index 46850e0f99e1..bb8224b19438 100644 --- a/selfservice/flow/login/handler.go +++ b/selfservice/flow/login/handler.go @@ -159,7 +159,7 @@ preLoginHook: } } - if err := sortNodes(f.UI.Nodes); err != nil { + if err := sortNodes(r.Context(), f.UI.Nodes); err != nil { return nil, err } @@ -588,7 +588,7 @@ continueLogin: sess = session.NewInactiveSession() } - method := ss.CompletedAuthenticationMethod(ctx) + method := ss.CompletedAuthenticationMethod(r.Context()) sess.CompletedLoginFor(method.Method, method.AAL) i = interim break diff --git a/selfservice/flow/login/sort.go b/selfservice/flow/login/sort.go index d306a1fdcf65..e1c22357841e 100644 --- a/selfservice/flow/login/sort.go +++ b/selfservice/flow/login/sort.go @@ -6,9 +6,7 @@ import ( "github.com/ory/kratos/ui/node" ) -var ctx = context.Background() - -func sortNodes(n node.Nodes) error { +func sortNodes(ctx context.Context, n node.Nodes) error { return n.SortBySchema(ctx, node.SortByGroups([]node.Group{ node.OpenIDConnectGroup, diff --git a/ui/container/container_test.go b/ui/container/container_test.go index 8ee47c8e1332..0721503248dd 100644 --- a/ui/container/container_test.go +++ b/ui/container/container_test.go @@ -40,9 +40,8 @@ func newFormRequest(t *testing.T, values url.Values) *http.Request { return req } -var ctx = context.Background() - func TestContainer(t *testing.T) { + var ctx = context.Background() t.Run("method=NewFromJSON", func(t *testing.T) { for k, tc := range []struct { r string diff --git a/ui/node/attributes_input_test.go b/ui/node/attributes_input_test.go index d8276a837b54..cef15c1451bd 100644 --- a/ui/node/attributes_input_test.go +++ b/ui/node/attributes_input_test.go @@ -15,9 +15,9 @@ import ( "github.com/ory/x/jsonschemax" ) -var ctx = context.Background() - func TestFieldFromPath(t *testing.T) { + + var ctx = context.Background() t.Run("all properties are properly transferred", func(t *testing.T) { schema, err := ioutil.ReadFile("./fixtures/all_formats.schema.json") require.NoError(t, err)