Skip to content

Commit 169eeee

Browse files
wolfogrelunny
andauthored
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]>
1 parent 3aacc9b commit 169eeee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: routers/web/auth/auth.go

+7
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,13 @@ func handleAccountActivation(ctx *context.Context, user *user_model.User) {
783783
return
784784
}
785785

786+
// Register last login
787+
user.SetLastLogin()
788+
if err := user_model.UpdateUserCols(ctx, user, "last_login_unix"); err != nil {
789+
ctx.ServerError("UpdateUserCols", err)
790+
return
791+
}
792+
786793
ctx.Flash.Success(ctx.Tr("auth.account_activated"))
787794
ctx.Redirect(setting.AppSubURL + "/")
788795
}

0 commit comments

Comments
 (0)