diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-15 22:10:49 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-15 22:10:49 +1200 |
commit | a6a9d9306562ae4edcf7065a024e3837d7ba7551 (patch) | |
tree | 65fb5ca78cedad92e03c16cba73b8c831c51fcda /src/org/traccar | |
parent | 6439ce3fa3a58150b88f074c5498627b7e14f79a (diff) | |
download | trackermap-web-a6a9d9306562ae4edcf7065a024e3837d7ba7551.tar.gz trackermap-web-a6a9d9306562ae4edcf7065a024e3837d7ba7551.tar.bz2 trackermap-web-a6a9d9306562ae4edcf7065a024e3837d7ba7551.zip |
Login modifications
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/web/client/controller/LoginController.java | 42 | ||||
-rw-r--r-- | src/org/traccar/web/server/model/DataServiceImpl.java | 2 |
2 files changed, 20 insertions, 24 deletions
diff --git a/src/org/traccar/web/client/controller/LoginController.java b/src/org/traccar/web/client/controller/LoginController.java index 06471377..f8fdc8c2 100644 --- a/src/org/traccar/web/client/controller/LoginController.java +++ b/src/org/traccar/web/client/controller/LoginController.java @@ -39,13 +39,13 @@ public class LoginController implements LoginDialog.LoginHandler { Application.getDataService().authenticated(new BaseAsyncCallback<User>() { @Override public void onSuccess(User result) { - if (result != null) { - ApplicationContext.getInstance().setUser(result); - loginHandler.onLogin(); - } else { - dialog = new LoginDialog(LoginController.this); - dialog.show(); - } + ApplicationContext.getInstance().setUser(result); + loginHandler.onLogin(); + } + @Override + public void onFailure(Throwable caught) { + dialog = new LoginDialog(LoginController.this); + dialog.show(); } }); } @@ -64,16 +64,16 @@ public class LoginController implements LoginDialog.LoginHandler { Application.getDataService().login(login, password, new BaseAsyncCallback<User>() { @Override public void onSuccess(User result) { - if (result != null) { - ApplicationContext.getInstance().setUser(result); - if (loginHandler != null) { - dialog.hide(); - loginHandler.onLogin(); - } - } else { - new AlertMessageBox("Error", "User name or password is invalid").show(); + ApplicationContext.getInstance().setUser(result); + if (loginHandler != null) { + dialog.hide(); + loginHandler.onLogin(); } } + @Override + public void onFailure(Throwable caught) { + new AlertMessageBox("Error", "User name or password is invalid").show(); + } }); } } @@ -84,14 +84,10 @@ public class LoginController implements LoginDialog.LoginHandler { Application.getDataService().register(login, password, new BaseAsyncCallback<User>() { @Override public void onSuccess(User result) { - if (result != null) { - ApplicationContext.getInstance().setUser(result); - if (loginHandler != null) { - dialog.hide(); - loginHandler.onLogin(); - } - } else { - new AlertMessageBox("Error", "Registration error").show(); + ApplicationContext.getInstance().setUser(result); + if (loginHandler != null) { + dialog.hide(); + loginHandler.onLogin(); } } }); diff --git a/src/org/traccar/web/server/model/DataServiceImpl.java b/src/org/traccar/web/server/model/DataServiceImpl.java index c2ebce15..6e99897b 100644 --- a/src/org/traccar/web/server/model/DataServiceImpl.java +++ b/src/org/traccar/web/server/model/DataServiceImpl.java @@ -134,7 +134,7 @@ public class DataServiceImpl extends RemoteServiceServlet implements DataService setSessionUser(user); return user; } - return null; + throw new IllegalStateException(); } } |