From 5a6cba4cf43f9e5be3ca4a3ffd8bfa351c92acbd Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 10 Nov 2022 00:42:06 +0800 Subject: [PATCH] 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 --- routers/web/auth/auth.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go index 25d70d7c4781..0f8128946c94 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 + "/") }