aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2022-11-10 00:42:06 +0800
committerGitHub <noreply@github.com>2022-11-09 11:42:06 -0500
commit5a6cba4cf43f9e5be3ca4a3ffd8bfa351c92acbd (patch)
tree493e5ddecca6ee82c4e5e3a72ba3b4c14ba0b4b5
parentdd7f1c0334dff5fb5eb93765dff3b951a9f6b3fc (diff)
downloadgitea-5a6cba4cf43f9e5be3ca4a3ffd8bfa351c92acbd.tar.gz
gitea-5a6cba4cf43f9e5be3ca4a3ffd8bfa351c92acbd.zip
Set last login when activating account (#21731)
Fix #21698. Set the last login time to the current time when activating the user successfully. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
-rw-r--r--routers/web/auth/auth.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go
index 25d70d7c47..0f8128946c 100644
--- a/routers/web/auth/auth.go
+++ b/routers/web/auth/auth.go
@@ -783,6 +783,13 @@ func handleAccountActivation(ctx *context.Context, user *user_model.User) {
return
}
+ // Register last login
+ user.SetLastLogin()
+ if err := user_model.UpdateUserCols(ctx, user, "last_login_unix"); err != nil {
+ ctx.ServerError("UpdateUserCols", err)
+ return
+ }
+
ctx.Flash.Success(ctx.Tr("auth.account_activated"))
ctx.Redirect(setting.AppSubURL + "/")
}