From 9153b6ed9667a394677a0f96b83a4bc3cd1124b6 Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 24 Jan 2019 15:17:09 +0100 Subject: [PATCH] improves readability of loginping handler --- conf/sample.ini | 4 ++-- pkg/api/login.go | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/conf/sample.ini b/conf/sample.ini index 28998961350..ba25c335768 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -115,8 +115,8 @@ log_queries = # How many days an session can be unused before we inactivate it ;login_remember_days = 7 -# How often should the login token be rotated. default to '30m' -;rotate_cookie_every = 30m +# How often should the login token be rotated. default to '30' +;rotate_token_minutes = 30 # How long should Grafana keep expired tokens before deleting them ;delete_expired_token_after_days = 30 diff --git a/pkg/api/login.go b/pkg/api/login.go index db75b12a202..24e215b0490 100644 --- a/pkg/api/login.go +++ b/pkg/api/login.go @@ -78,13 +78,12 @@ func tryOAuthAutoLogin(c *m.ReqContext) bool { return false } -func (hs *HTTPServer) LoginAPIPing(c *m.ReqContext) { - if !c.IsSignedIn || !c.IsAnonymous { - c.JsonApiErr(401, "Unauthorized", nil) - return +func (hs *HTTPServer) LoginAPIPing(c *m.ReqContext) Response { + if c.IsSignedIn || c.IsAnonymous { + return JSON(200, "Logged in") } - c.JsonOK("Logged in") + return Error(401, "Unauthorized", nil) } func (hs *HTTPServer) LoginPost(c *m.ReqContext, cmd dtos.LoginCommand) Response {