Skip to content

Commit

Permalink
Set last login when activating account (#21731)
Browse files Browse the repository at this point in the history
Fix #21698.

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
wolfogre and lunny authored Nov 9, 2022
1 parent dd7f1c0 commit 5a6cba4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions routers/web/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "/")
}
Expand Down

0 comments on commit 5a6cba4

Please sign in to comment.