added hosted domain suppport to google oauth login (#6372)

This commit is contained in:
Eric Uldall
2016-10-28 03:00:47 -07:00
committed by Torkel Ödegaard
parent 7acdbde8f0
commit 658fc1a67a
5 changed files with 10 additions and 1 deletions

View File

@@ -53,7 +53,11 @@ func OAuthLogin(ctx *middleware.Context) {
if code == "" {
state := GenStateString()
ctx.Session.Set(middleware.SESS_KEY_OAUTH_STATE, state)
ctx.Redirect(connect.AuthCodeURL(state, oauth2.AccessTypeOnline))
if setting.OAuthService.OAuthInfos[name].HostedDomain == "" {
ctx.Redirect(connect.AuthCodeURL(state, oauth2.AccessTypeOnline))
}else{
ctx.Redirect(connect.AuthCodeURL(state, oauth2.SetParam("hd", setting.OAuthService.OAuthInfos[name].HostedDomain), oauth2.AccessTypeOnline));
}
return
}