From 43bddc1405fc533b887a2d6223b084f5e14ef49a Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 10 Nov 2022 11:15:28 +0800 Subject: [PATCH] Set last login when activating account (#21731) (#21754) Backport #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 bda6789d8d6..bb249c1eca1 100644 --- a/routers/web/auth/auth.go +++ b/routers/web/auth/auth.go @@ -775,6 +775,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 + "/") }