From d7ce99526c568119aca6e2b834303effd7959307 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Date: Sun, 10 Feb 2019 13:28:35 +0900 Subject: [PATCH] update last login date when API access. close #841 --- .../gitbucket/core/servlet/ApiAuthenticationFilter.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala b/src/main/scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala index cca7d7b9d..4576b0c89 100644 --- a/src/main/scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala +++ b/src/main/scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala @@ -28,8 +28,11 @@ class ApiAuthenticationFilter extends Filter with AccessTokenService with Accoun .orElse { Option(request.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account]).map(Right(_)) } match { - case Some(Right(account)) => request.setAttribute(Keys.Session.LoginAccount, account); chain.doFilter(req, res) - case None => chain.doFilter(req, res) + case Some(Right(account)) => + request.setAttribute(Keys.Session.LoginAccount, account) + updateLastLoginDate(account.userName) + chain.doFilter(req, res) + case None => chain.doFilter(req, res) case Some(Left(_)) => { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED) response.setContentType("application/json; charset=utf-8")