aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-04-15 22:10:49 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-04-15 22:10:49 +1200
commita6a9d9306562ae4edcf7065a024e3837d7ba7551 (patch)
tree65fb5ca78cedad92e03c16cba73b8c831c51fcda /src
parent6439ce3fa3a58150b88f074c5498627b7e14f79a (diff)
downloadetbsa-traccar-web-a6a9d9306562ae4edcf7065a024e3837d7ba7551.tar.gz
etbsa-traccar-web-a6a9d9306562ae4edcf7065a024e3837d7ba7551.tar.bz2
etbsa-traccar-web-a6a9d9306562ae4edcf7065a024e3837d7ba7551.zip
Login modifications
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/web/client/controller/LoginController.java42
-rw-r--r--src/org/traccar/web/server/model/DataServiceImpl.java2
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 0647137..f8fdc8c 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 c2ebce1..6e99897 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();
}
}