Chore: add context to login (#41316)

* Chore: add context to login attempt file and tests

* Chore: add context

* Chore: add context to login and login tests

* Chore: continue adding context to login

* Chore: add context to login query
This commit is contained in:
Katarina Yang
2021-11-08 09:53:51 -05:00
committed by GitHub
parent b58cca5d51
commit c4306f9b3e
22 changed files with 90 additions and 78 deletions

View File

@ -1,6 +1,7 @@
package api
import (
"context"
"errors"
"fmt"
"net/http"
@ -176,7 +177,7 @@ func (hs *HTTPServer) PostSyncUserWithLDAP(c *models.ReqContext) response.Respon
authModuleQuery := &models.GetAuthInfoQuery{UserId: query.Result.Id, AuthModule: models.AuthModuleLDAP}
if err := bus.Dispatch(authModuleQuery); err != nil { // validate the userId comes from LDAP
if err := bus.DispatchCtx(context.TODO(), authModuleQuery); err != nil { // validate the userId comes from LDAP
if errors.Is(err, models.ErrUserNotFound) {
return response.Error(404, models.ErrUserNotFound.Error(), nil)
}