aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-08-09 18:01:29 -0700
committerUnknwon <joe2010xtmf@163.com>2014-08-09 18:01:29 -0700
commit5605af973b440add79b1c32c911bee03fa821a4e (patch)
tree5bd6f7145e190933016dd745a833b9596bef87fe
parent78defd238c939ff577041f2e7b95b2ae48a9fb27 (diff)
Feature: Social sign in
-rw-r--r--conf/locale/locale_zh-CN.ini1
-rw-r--r--modules/base/template.go6
-rw-r--r--routers/user/social.go6
3 files changed, 9 insertions, 4 deletions
diff --git a/conf/locale/locale_zh-CN.ini b/conf/locale/locale_zh-CN.ini
index 31b99c60..8aec5009 100644
--- a/conf/locale/locale_zh-CN.ini
+++ b/conf/locale/locale_zh-CN.ini
@@ -5,6 +5,7 @@ dashboard = 控制面板
explore = 探索
help = 帮助
sign_in = 登录
+social_sign_in = 社交帐号登录:第 2 步 <small>关联帐号</small>
sign_out = 退出
sign_up = 注册
register = 注册
diff --git a/modules/base/template.go b/modules/base/template.go
index 51b1dfff..f2ae00b9 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -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"
}
diff --git a/routers/user/social.go b/routers/user/social.go
index d7486dad..07c6deed 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
}