feat(account): stamp last-login time + IP on cold app-load
The profile GET (fetched once per cold app-load by the SPA) stamps accounts .last_login_at/.last_login_ip, throttled to at most once per hour per account (best-effort, never blocks the read). IP from the gateway-forwarded X-Forwarded-For. Feeds the account-deletion dossier. Integration test covers the throttle.
This commit is contained in:
@@ -25,6 +25,10 @@ func (s *Server) handleProfile(c *gin.Context) {
|
||||
s.abortErr(c, err)
|
||||
return
|
||||
}
|
||||
// The SPA fetches the profile once per cold app-load, so stamp the account's last
|
||||
// login time and client IP here (throttled to at most once an hour). Best-effort: it
|
||||
// feeds the deletion dossier, never blocks the profile read.
|
||||
_ = s.accounts.StampLastLogin(c.Request.Context(), uid, clientIP(c))
|
||||
c.JSON(http.StatusOK, s.profileResponse(c.Request.Context(), acc))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user