aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorDan <djr2468@gmail.com>2023-04-01 22:07:42 +0100
committerDan <djr2468@gmail.com>2023-04-01 22:07:42 +0100
commitf8339b4ca0ca7440854f759b32b821afe19f458b (patch)
tree66c0e14ee8d4f1f58052db187151aa0b4a7762e7 /src/main/java/org/traccar/api
parent7da68f71329f65d34a96bec26594c4b760384361 (diff)
downloadtrackermap-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/api')
-rw-r--r--src/main/java/org/traccar/api/security/LoginService.java13
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");