From f8339b4ca0ca7440854f759b32b821afe19f458b Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 1 Apr 2023 22:07:42 +0100 Subject: Add user lookup method --- src/main/java/org/traccar/api/security/LoginService.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/org/traccar/api/security/LoginService.java b/src/main/java/org/traccar/api/security/LoginService.java index 88bafcfb5..3d4f42b20 100644 --- a/src/main/java/org/traccar/api/security/LoginService.java +++ b/src/main/java/org/traccar/api/security/LoginService.java @@ -89,6 +89,19 @@ public class LoginService { return null; } + public User lookup(String email) throws StorageException { + User user = storage.getObject(User.class, new Request( + new Columns.All(), + new Condition.Equals("email", email))); + + if (user != null) { + checkUserEnabled(user); + return user; + } + + return null; + } + private void checkUserEnabled(User user) throws SecurityException { if (user == null) { throw new SecurityException("Unknown account"); -- cgit v1.2.3