Don't ping LastLoginAt when impersonated
This commit is contained in:
parent
5d19692023
commit
bb26c976d3
|
@ -40,8 +40,8 @@ func LoginRequired(handler http.Handler) http.Handler {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ping LastLoginAt for long lived sessions.
|
// Ping LastLoginAt for long lived sessions, but not if impersonated.
|
||||||
if time.Since(user.LastLoginAt) > config.LastLoginAtCooldown {
|
if time.Since(user.LastLoginAt) > config.LastLoginAtCooldown && !session.Impersonated(r) {
|
||||||
user.LastLoginAt = time.Now()
|
user.LastLoginAt = time.Now()
|
||||||
if err := user.Save(); err != nil {
|
if err := user.Save(); err != nil {
|
||||||
log.Error("LoginRequired: couldn't refresh LastLoginAt for user %s: %s", user.Username, err)
|
log.Error("LoginRequired: couldn't refresh LastLoginAt for user %s: %s", user.Username, err)
|
||||||
|
|
|
@ -170,8 +170,6 @@ func ImpersonateUser(w http.ResponseWriter, r *http.Request, u *models.User, imp
|
||||||
sess.Impersonator = impersonator.ID
|
sess.Impersonator = impersonator.ID
|
||||||
sess.Save(w)
|
sess.Save(w)
|
||||||
|
|
||||||
// Ping the user's last login time.
|
|
||||||
u.LastLoginAt = time.Now()
|
|
||||||
return u.Save()
|
return u.Save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user