3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-25 18:55:37 -06:00

redirect user to requested url after login via oauth

This commit is contained in:
Dan Cech 2017-02-09 14:01:53 -05:00
parent c7febca447
commit b22881c717

View File

@ -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 + "/")
}