aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/web/server/model/DataServiceImpl.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java
index a81785b7..eb466694 100644
--- a/src/org/traccar/web/server/model/DataServiceImpl.java
+++ b/src/org/traccar/web/server/model/DataServiceImpl.java
@@ -167,6 +167,9 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
@Override
public User addUser(User user) {
User currentUser = getSessionUser();
+ if (user.getLogin().isEmpty() || user.getPassword().isEmpty()) {
+ throw new IllegalArgumentException();
+ }
if (currentUser.getAdmin()) {
EntityManager entityManager = getSessionEntityManager();
synchronized (entityManager) {
@@ -188,6 +191,9 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService
@Override
public User updateUser(User user) {
User currentUser = getSessionUser();
+ if (user.getLogin().isEmpty() || user.getPassword().isEmpty()) {
+ throw new IllegalArgumentException();
+ }
if (currentUser.getAdmin() || (currentUser.getId() == user.getId() && !user.getAdmin())) {
EntityManager entityManager = getSessionEntityManager();
synchronized (entityManager) {