diff options
author | Dan <djr2468@gmail.com> | 2023-04-01 22:07:42 +0100 |
---|---|---|
committer | Dan <djr2468@gmail.com> | 2023-04-01 22:07:42 +0100 |
commit | f8339b4ca0ca7440854f759b32b821afe19f458b (patch) | |
tree | 66c0e14ee8d4f1f58052db187151aa0b4a7762e7 /src/main/java/org/traccar | |
parent | 7da68f71329f65d34a96bec26594c4b760384361 (diff) | |
download | trackermap-server-f8339b4ca0ca7440854f759b32b821afe19f458b.tar.gz trackermap-server-f8339b4ca0ca7440854f759b32b821afe19f458b.tar.bz2 trackermap-server-f8339b4ca0ca7440854f759b32b821afe19f458b.zip |
Add user lookup method
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/api/security/LoginService.java | 13 |
1 files changed, 13 insertions, 0 deletions
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"); |