1
0
Fork 0
forked from forgejo/forgejo

Only update needed columns when update user (#2296)

* only update needed columns when update user

* fix missing update_unix column
This commit is contained in:
Lunny Xiao 2017-08-12 22:18:44 +08:00 committed by GitHub
parent 921d90fd8b
commit f960e19c59
6 changed files with 45 additions and 17 deletions

View file

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