aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/api/resource/SessionResource.java2
-rw-r--r--src/org/traccar/model/User.java4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/org/traccar/api/resource/SessionResource.java b/src/org/traccar/api/resource/SessionResource.java
index db8a5c837..996865c4b 100644
--- a/src/org/traccar/api/resource/SessionResource.java
+++ b/src/org/traccar/api/resource/SessionResource.java
@@ -71,7 +71,7 @@ public class SessionResource extends BaseResource {
request.getSession().setAttribute(USER_ID_KEY, userId);
}
} else if (token != null) {
- User user = Context.getPermissionsManager().getUserByToken(request.getParameter("token"));
+ User user = Context.getPermissionsManager().getUserByToken(token);
if (user != null) {
userId = user.getId();
request.getSession().setAttribute(USER_ID_KEY, userId);
diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java
index aa24b795e..411b556fc 100644
--- a/src/org/traccar/model/User.java
+++ b/src/org/traccar/model/User.java
@@ -187,11 +187,13 @@ public class User extends Extensible {
}
public void setToken(String token) {
- if (token != null && !token.isEmpty()) {
+ if (token != null) {
if (!token.matches("^[a-zA-Z0-9]{16,}$")) {
throw new IllegalArgumentException("Illegal token");
}
this.token = token;
+ } else {
+ this.token = null;
}
}