mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fixes nil ref in tests
This commit is contained in:
parent
31b5db06f1
commit
c3ff3d644c
@ -47,13 +47,13 @@ func (hs *HTTPServer) LoginView(c *m.ReqContext) {
|
||||
return
|
||||
//}
|
||||
|
||||
if redirectTo, _ := url.QueryUnescape(c.GetCookie("redirect_to")); len(redirectTo) > 0 {
|
||||
c.SetCookie("redirect_to", "", -1, setting.AppSubUrl+"/")
|
||||
c.Redirect(redirectTo)
|
||||
return
|
||||
}
|
||||
// if redirectTo, _ := url.QueryUnescape(c.GetCookie("redirect_to")); len(redirectTo) > 0 {
|
||||
// c.SetCookie("redirect_to", "", -1, setting.AppSubUrl+"/")
|
||||
// c.Redirect(redirectTo)
|
||||
// return
|
||||
// }
|
||||
|
||||
c.Redirect(setting.AppSubUrl + "/")
|
||||
// c.Redirect(setting.AppSubUrl + "/")
|
||||
}
|
||||
|
||||
func tryOAuthAutoLogin(c *m.ReqContext) bool {
|
||||
|
@ -66,7 +66,7 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
|
||||
query.UserId = getRequestUserId(ctx)
|
||||
// if we're using ldap, pass authproxy login name to ldap user sync
|
||||
} else if setting.LdapEnabled {
|
||||
ctx.Session.Delete(session.SESS_KEY_LASTLDAPSYNC)
|
||||
ctx.Session.Delete(session.SESS_KEY_LASTLDAPSYNC) //makes sure we always sync with ldap if session if we only have last sync info in session but not user.
|
||||
|
||||
syncQuery := &m.LoginUserQuery{
|
||||
ReqContext: ctx,
|
||||
|
@ -291,7 +291,14 @@ func createTestContext(t *testing.T) *testContext {
|
||||
sqlstore := sqlstore.InitTestDB(t)
|
||||
tokenService := &UserAuthTokenServiceImpl{
|
||||
SQLStore: sqlstore,
|
||||
log: log.New("test-logger"),
|
||||
Cfg: &setting.Cfg{
|
||||
LoginCookieName: "grafana_session",
|
||||
LoginCookieUsername: "grafana_username",
|
||||
LoginCookieSecure: false,
|
||||
LoginCookieMaxDays: 7,
|
||||
LoginDeleteExpiredTokensAfterDays: 30,
|
||||
},
|
||||
log: log.New("test-logger"),
|
||||
}
|
||||
|
||||
RotateTime = 10 * time.Minute
|
||||
|
Loading…
Reference in New Issue
Block a user