1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

clean oauth2 code

This commit is contained in:
skyblue
2014-04-12 09:42:09 +08:00
parent 4c6e0e9499
commit 5c1312f38e
6 changed files with 21 additions and 29 deletions

View File

@@ -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: