Set last login when activating account (#21731) (#21755)

Backport #21731.

Fix #21698.

Set the last login time to the current time when activating the user
successfully.

Co-authored-by: Lunny Xiao <[email protected]>

Co-authored-by: Lunny Xiao <[email protected]>
This commit is contained in:
Jason Song
2022-11-11 01:26:17 -05:00
committed by GitHub
co-authored by Lunny Xiao
parent 3aacc9b4ac
commit 169eeee101
+7
View File
@@ -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 + "/")
}