diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-08-09 18:01:29 -0700 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-08-09 18:01:29 -0700 |
commit | 5605af973b440add79b1c32c911bee03fa821a4e (patch) | |
tree | 5bd6f7145e190933016dd745a833b9596bef87fe /routers/user | |
parent | 78defd238c939ff577041f2e7b95b2ae48a9fb27 (diff) | |
download | gitea-5605af973b440add79b1c32c911bee03fa821a4e.tar.gz gitea-5605af973b440add79b1c32c911bee03fa821a4e.zip |
Feature: Social sign in
Diffstat (limited to 'routers/user')
-rw-r--r-- | routers/user/social.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/user/social.go b/routers/user/social.go index d7486dad2b..07c6deed6d 100644 --- a/routers/user/social.go +++ b/routers/user/social.go @@ -40,11 +40,15 @@ func SocialSignIn(ctx *middleware.Context) { ctx.Handle(404, "social.SocialSignIn(social login not enabled)", errors.New(name)) return } + appUrl := strings.TrimSuffix(setting.AppUrl, "/") + if name == "weibo" { + appUrl = strings.Replace(appUrl, "localhost", "127.0.0.1", 1) + } code := ctx.Query("code") if code == "" { // redirect to social login page - connect.SetRedirectUrl(strings.TrimSuffix(setting.AppUrl, "/") + ctx.Req.URL.Path) + connect.SetRedirectUrl(appUrl + ctx.Req.URL.Path) ctx.Redirect(connect.AuthCodeURL(next)) return } |