summaryrefslogtreecommitdiffstats
path: root/routers/user/auth_openid.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-08-12 16:18:44 +0200
committerGitHub <noreply@github.com>2017-08-12 16:18:44 +0200
commitf960e19c590d27fe62a3a6241f1ea8b7fadde13a (patch)
treecb5045491959550fad930e82434a7f6e27d33cf3 /routers/user/auth_openid.go
parentfix 500 error when view an issue which's milestone deleted (#2297) (diff)
downloadforgejo-f960e19c590d27fe62a3a6241f1ea8b7fadde13a.tar.xz
forgejo-f960e19c590d27fe62a3a6241f1ea8b7fadde13a.zip
Only update needed columns when update user (#2296)
* only update needed columns when update user * fix missing update_unix column
Diffstat (limited to 'routers/user/auth_openid.go')
-rw-r--r--routers/user/auth_openid.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/user/auth_openid.go b/routers/user/auth_openid.go
index ff03e538f8..dcc3fcf0fc 100644
--- a/routers/user/auth_openid.go
+++ b/routers/user/auth_openid.go
@@ -404,7 +404,8 @@ func RegisterOpenIDPost(ctx *context.Context, cpt *captcha.Captcha, form auth.Si
if models.CountUsers() == 1 {
u.IsAdmin = true
u.IsActive = true
- if err := models.UpdateUser(u); err != nil {
+ u.SetLastLogin()
+ if err := models.UpdateUserCols(u, "is_admin", "is_active", "last_login_unix"); err != nil {
ctx.Handle(500, "UpdateUser", err)
return
}