diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-08-09 17:25:02 -0700 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-08-09 17:25:02 -0700 |
commit | 78defd238c939ff577041f2e7b95b2ae48a9fb27 (patch) | |
tree | 5dd168d880ece655796558874f352b2c2263e965 /routers/user/social.go | |
parent | 08c6d07aad65f45efd5bf9f50d9cda68f59c0e69 (diff) | |
download | gitea-78defd238c939ff577041f2e7b95b2ae48a9fb27.tar.gz gitea-78defd238c939ff577041f2e7b95b2ae48a9fb27.zip |
Page: Manage social accounts
Diffstat (limited to 'routers/user/social.go')
-rw-r--r-- | routers/user/social.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/routers/user/social.go b/routers/user/social.go index ef83cd5b42..d7486dad2b 100644 --- a/routers/user/social.go +++ b/routers/user/social.go @@ -10,6 +10,7 @@ import ( "fmt" "net/url" "strings" + "time" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/log" @@ -67,8 +68,8 @@ func SocialSignIn(ctx *middleware.Context) { oa, err := models.GetOauth2(ui.Identity) switch err { case nil: - ctx.Session.Set("userId", oa.User.Id) - ctx.Session.Set("userName", oa.User.Name) + ctx.Session.Set("uid", oa.User.Id) + ctx.Session.Set("uname", oa.User.Name) case models.ErrOauth2RecordNotExist: raw, _ := json.Marshal(tk) oa = &models.Oauth2{ @@ -89,6 +90,11 @@ func SocialSignIn(ctx *middleware.Context) { return } + oa.Updated = time.Now() + if err = models.UpdateOauth2(oa); err != nil { + log.Error(4, "UpdateOauth2: %v", err) + } + ctx.Session.Set("socialId", oa.Id) ctx.Session.Set("socialName", ui.Name) ctx.Session.Set("socialEmail", ui.Email) |