diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-15 20:59:11 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-15 20:59:11 +1200 |
commit | cce90872fe9bbdfaa26e90cd0f9dbc97a74bf495 (patch) | |
tree | 5ce0076c7a89f7bbb3624fbfac44683d546f113d | |
parent | 4f3cbf8afda8216f5fffa3f5288dea9779dc4881 (diff) | |
download | trackermap-web-cce90872fe9bbdfaa26e90cd0f9dbc97a74bf495.tar.gz trackermap-web-cce90872fe9bbdfaa26e90cd0f9dbc97a74bf495.tar.bz2 trackermap-web-cce90872fe9bbdfaa26e90cd0f9dbc97a74bf495.zip |
Check for empty login and password (fix #23)
-rw-r--r-- | src/org/traccar/web/server/model/DataServiceImpl.java | 6 |
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) { |