Skip to content

Commit 43bddc1

Browse files
wolfogrelunny
andauthored
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 <[email protected]>
1 parent 9414260 commit 43bddc1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

routers/web/auth/auth.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,13 @@ func handleAccountActivation(ctx *context.Context, user *user_model.User) {
775775
return
776776
}
777777

778+
// Register last login
779+
user.SetLastLogin()
780+
if err := user_model.UpdateUserCols(ctx, user, "last_login_unix"); err != nil {
781+
ctx.ServerError("UpdateUserCols", err)
782+
return
783+
}
784+
778785
ctx.Flash.Success(ctx.Tr("auth.account_activated"))
779786
ctx.Redirect(setting.AppSubURL + "/")
780787
}

0 commit comments

Comments
 (0)