diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-24 08:59:27 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-24 08:59:27 -0700 |
commit | fed6597faa141ba3ee8b11bff2c987ac981fd91b (patch) | |
tree | d2b26e0cc068f00526c46c584a0304df050e0d38 /src/main/java/org/traccar/api | |
parent | 69d45b4429be70ce079b51200f6baefeb3873220 (diff) | |
download | trackermap-server-fed6597faa141ba3ee8b11bff2c987ac981fd91b.tar.gz trackermap-server-fed6597faa141ba3ee8b11bff2c987ac981fd91b.tar.bz2 trackermap-server-fed6597faa141ba3ee8b11bff2c987ac981fd91b.zip |
Include address in login logs
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r-- | src/main/java/org/traccar/api/resource/SessionResource.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/api/resource/SessionResource.java b/src/main/java/org/traccar/api/resource/SessionResource.java index 8422e0b49..136aab0eb 100644 --- a/src/main/java/org/traccar/api/resource/SessionResource.java +++ b/src/main/java/org/traccar/api/resource/SessionResource.java @@ -110,8 +110,7 @@ public class SessionResource extends BaseResource { @FormParam("email") String email, @FormParam("password") String password) throws StorageException { User user = Context.getPermissionsManager().login(email, password); if (user != null) { - request.getSession().setAttribute(USER_ID_KEY, user.getId()); - LogAction.login(user.getId()); + LogAction.login(user.getId(), ServletHelper.retrieveRemoteAddress(request)); return user; } else { LogAction.failedLogin(ServletHelper.retrieveRemoteAddress(request)); @@ -121,7 +120,7 @@ public class SessionResource extends BaseResource { @DELETE public Response remove() { - LogAction.logout(getUserId()); + LogAction.logout(getUserId(), ServletHelper.retrieveRemoteAddress(request)); request.getSession().removeAttribute(USER_ID_KEY); return Response.noContent().build(); } |