Commit 73d44145 by Carl Bergquist Committed by GitHub

Merge pull request #7516 from grafana/oauth-login-redirect

redirect user to requested url after login via oauth
parents 5dd961c0 b22881c7
......@@ -10,6 +10,7 @@ import (
"io/ioutil"
"log"
"net/http"
"net/url"
"golang.org/x/net/context"
"golang.org/x/oauth2"
......@@ -177,5 +178,11 @@ func OAuthLogin(ctx *middleware.Context) {
metrics.M_Api_Login_OAuth.Inc(1)
if redirectTo, _ := url.QueryUnescape(ctx.GetCookie("redirect_to")); len(redirectTo) > 0 {
ctx.SetCookie("redirect_to", "", -1, setting.AppSubUrl+"/")
ctx.Redirect(redirectTo)
return
}
ctx.Redirect(setting.AppSubUrl + "/")
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment