summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-11 21:47:43 -0400
committerUnknown <joe2010xtmf@163.com>2014-04-11 21:47:43 -0400
commit4fc5dcc7648c9e01e05f9dbf08e930ba325839d9 (patch)
tree34bc4d3cc3ce0edf0ee139605c966d0199d14eb3 /routers
parent33aa4f74380ab117673a1cc30bead3a7f2b3cb4b (diff)
parentf8e97b75fbe7201830413fabead33967fb690827 (diff)
downloadgitea-4fc5dcc7648c9e01e05f9dbf08e930ba325839d9.tar.gz
gitea-4fc5dcc7648c9e01e05f9dbf08e930ba325839d9.zip
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'routers')
-rw-r--r--routers/user/social.go8
-rw-r--r--routers/user/user.go6
2 files changed, 8 insertions, 6 deletions
diff --git a/routers/user/social.go b/routers/user/social.go
index 8568bc2af8..3e5f69beff 100644
--- a/routers/user/social.go
+++ b/routers/user/social.go
@@ -17,7 +17,6 @@ import (
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware"
- "github.com/gogits/gogs/modules/oauth2"
)
type SocialConnector interface {
@@ -77,7 +76,10 @@ func extractPath(next string) string {
}
// github && google && ...
-func SocialSignIn(ctx *middleware.Context, tokens oauth2.Tokens) {
+func SocialSignIn(ctx *middleware.Context) {
+ //if base.OauthService != nil && base.OauthService.GitHub.Enabled {
+ //}
+
var socid int64
var ok bool
next := extractPath(ctx.Query("next"))
@@ -142,9 +144,9 @@ func SocialSignIn(ctx *middleware.Context, tokens oauth2.Tokens) {
return
}
case models.ErrOauth2NotAssociatedWithUser:
+ ctx.Session.Set("socialId", oa.Id)
ctx.Session.Set("socialName", soc.Name())
ctx.Session.Set("socialEmail", soc.Email())
- ctx.Session.Set("socialId", oa.Id)
ctx.Redirect("/user/sign_up")
return
default:
diff --git a/routers/user/user.go b/routers/user/user.go
index 253ab7be00..8585267a64 100644
--- a/routers/user/user.go
+++ b/routers/user/user.go
@@ -82,7 +82,6 @@ func SignIn(ctx *middleware.Context) {
ctx.Data["OauthGitHubEnabled"] = base.OauthService.GitHub.Enabled
}
- var user *models.User
// Check auto-login.
userName := ctx.GetCookie(base.CookieUserName)
if len(userName) == 0 {
@@ -91,7 +90,6 @@ func SignIn(ctx *middleware.Context) {
}
isSucceed := false
- var err error
defer func() {
if !isSucceed {
log.Trace("%s auto-login cookie cleared: %s", ctx.Req.RequestURI, userName)
@@ -101,7 +99,7 @@ func SignIn(ctx *middleware.Context) {
}
}()
- user, err = models.GetUserByName(userName)
+ user, err := models.GetUserByName(userName)
if err != nil {
ctx.HTML(500, "user/signin")
return
@@ -181,6 +179,8 @@ func SignOut(ctx *middleware.Context) {
ctx.Session.Delete("userId")
ctx.Session.Delete("userName")
ctx.Session.Delete("socialId")
+ ctx.Session.Delete("socialName")
+ ctx.Session.Delete("socialEmail")
ctx.SetCookie(base.CookieUserName, "", -1)
ctx.SetCookie(base.CookieRememberName, "", -1)
ctx.Redirect("/")