summaryrefslogtreecommitdiffstats
path: root/routers/user/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user/auth.go')
-rw-r--r--routers/user/auth.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index f1aa9d26a8..b2caba0bb1 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -340,8 +340,8 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR
// Register last login
u.SetLastLogin()
- if err := models.UpdateUser(u); err != nil {
- ctx.Handle(500, "UpdateUser", err)
+ if err := models.UpdateUserCols(u, "last_login_unix"); err != nil {
+ ctx.Handle(500, "UpdateUserCols", err)
return
}
@@ -430,8 +430,8 @@ func handleOAuth2SignIn(u *models.User, gothUser goth.User, ctx *context.Context
// Register last login
u.SetLastLogin()
- if err := models.UpdateUser(u); err != nil {
- ctx.Handle(500, "UpdateUser", err)
+ if err := models.UpdateUserCols(u, "last_login_unix"); err != nil {
+ ctx.Handle(500, "UpdateUserCols", err)
return
}
@@ -666,7 +666,8 @@ func LinkAccountPostRegister(ctx *context.Context, cpt *captcha.Captcha, form au
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
}
@@ -781,7 +782,8 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
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
}
@@ -840,7 +842,7 @@ func Activate(ctx *context.Context) {
ctx.Handle(500, "UpdateUser", err)
return
}
- if err := models.UpdateUser(user); err != nil {
+ if err := models.UpdateUserCols(user, "is_active", "rands"); err != nil {
if models.IsErrUserNotExist(err) {
ctx.Error(404)
} else {
@@ -991,7 +993,7 @@ func ResetPasswdPost(ctx *context.Context) {
return
}
u.EncodePasswd()
- if err := models.UpdateUser(u); err != nil {
+ if err := models.UpdateUserCols(u, "passwd", "rands", "salt"); err != nil {
ctx.Handle(500, "UpdateUser", err)
return
}