]> source.dussan.org Git - gitea.git/commitdiff
Feature: Social sign in
authorUnknwon <joe2010xtmf@163.com>
Sun, 10 Aug 2014 01:01:29 +0000 (18:01 -0700)
committerUnknwon <joe2010xtmf@163.com>
Sun, 10 Aug 2014 01:01:29 +0000 (18:01 -0700)
conf/locale/locale_zh-CN.ini
modules/base/template.go
routers/user/social.go

index 31b99c6024f7fabd421ae7f66837dd3217426f9a..8aec50092ce6e63840d29339af973d94fa61477f 100644 (file)
@@ -5,6 +5,7 @@ dashboard = 控制面板
 explore = 探索
 help = 帮助
 sign_in = 登录
+social_sign_in = 社交帐号登录:第 2 步 <small>关联帐号</small>
 sign_out = 退出
 sign_up = 注册
 register = 注册
index 51b1dfff01d92f55f4c2fa7bccc22f076b818944..f2ae00b9159c0200e6dafed31d771b945e2eea08 100644 (file)
@@ -241,7 +241,7 @@ func Oauth2Icon(t int) string {
        case 3:
                return "fa-twitter-square"
        case 4:
-               return "fa-linux"
+               return "fa-qq"
        case 5:
                return "fa-weibo"
        }
@@ -253,11 +253,11 @@ func Oauth2Name(t int) string {
        case 1:
                return "GitHub"
        case 2:
-               return "Google"
+               return "Google+"
        case 3:
                return "Twitter"
        case 4:
-               return "Tencent QQ"
+               return "腾讯 QQ"
        case 5:
                return "Weibo"
        }
index d7486dad2b427e347f6da1d610a2d35160dc5ec8..07c6deed6dc65a2f5228ad79d5bbd36dc0c22465 100644 (file)
@@ -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
        }