diff options
Diffstat (limited to 'src/org/traccar/model/User.java')
-rw-r--r-- | src/org/traccar/model/User.java | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java index 816f49da9..e6b9d663f 100644 --- a/src/org/traccar/model/User.java +++ b/src/org/traccar/model/User.java @@ -188,23 +188,15 @@ public class User extends Extensible { public void setToken(String token) { if (token != null && !token.isEmpty()) { - if (validateToken(token)) { - this.token = token; - } else { - throw new IllegalArgumentException("Bad token"); + if (!token.matches("^[a-zA-Z0-9]{16,}$")) { + throw new IllegalArgumentException("Illegal token"); } + this.token = token; } else { this.token = null; } } - public static boolean validateToken(String token) { - if (token.length() < 16 || !token.matches("^[a-zA-Z0-9]+$")) { - return false; - } - return true; - } - public String getPassword() { return null; } |