aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-07 18:04:24 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-07 18:04:24 -0700
commit104281f161f622df8fca0c65a5b9969ceb03c46f (patch)
treed9bc756c29a9088a762bb434c443fccbb1eb9e7e /src/main/java/org/traccar/api
parentb745e3804950fefd24b38937c90c4d5c61219321 (diff)
downloadtrackermap-server-104281f161f622df8fca0c65a5b9969ceb03c46f.tar.gz
trackermap-server-104281f161f622df8fca0c65a5b9969ceb03c46f.tar.bz2
trackermap-server-104281f161f622df8fca0c65a5b9969ceb03c46f.zip
Extract user utils from reports
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/resource/PasswordResource.java3
-rw-r--r--src/main/java/org/traccar/api/security/PermissionsService.java2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/api/resource/PasswordResource.java b/src/main/java/org/traccar/api/resource/PasswordResource.java
index ed7131718..91d994153 100644
--- a/src/main/java/org/traccar/api/resource/PasswordResource.java
+++ b/src/main/java/org/traccar/api/resource/PasswordResource.java
@@ -51,7 +51,8 @@ public class PasswordResource extends BaseResource {
String token = UUID.randomUUID().toString().replaceAll("-", "");
user.set(PASSWORD_RESET_TOKEN, token);
Context.getUsersManager().updateItem(user);
- VelocityContext velocityContext = TextTemplateFormatter.prepareContext(null);
+ VelocityContext velocityContext = TextTemplateFormatter.prepareContext(
+ permissionsService.getServer(), user);
velocityContext.put("token", token);
NotificationMessage fullMessage =
TextTemplateFormatter.formatMessage(velocityContext, "passwordReset", "full");
diff --git a/src/main/java/org/traccar/api/security/PermissionsService.java b/src/main/java/org/traccar/api/security/PermissionsService.java
index 9ec3b43c1..c70414b2a 100644
--- a/src/main/java/org/traccar/api/security/PermissionsService.java
+++ b/src/main/java/org/traccar/api/security/PermissionsService.java
@@ -15,6 +15,7 @@
*/
package org.traccar.api.security;
+import com.google.inject.servlet.RequestScoped;
import org.traccar.model.BaseModel;
import org.traccar.model.Calendar;
import org.traccar.model.Command;
@@ -34,6 +35,7 @@ import org.traccar.storage.query.Request;
import javax.inject.Inject;
+@RequestScoped
public class PermissionsService {
private final Storage storage;