aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/client/controller/LoginController.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-02-20 22:35:43 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-02-20 22:35:43 +1300
commit6801698dfc9c99b34d7ed081ebcfbec4a8853868 (patch)
treececc80f811b6c3a594b9da272a7c65d3a9695315 /src/org/traccar/web/client/controller/LoginController.java
parent0e766c9024e2457320f64353e29bb5e2d8294b28 (diff)
downloadtrackermap-web-6801698dfc9c99b34d7ed081ebcfbec4a8853868.tar.gz
trackermap-web-6801698dfc9c99b34d7ed081ebcfbec4a8853868.tar.bz2
trackermap-web-6801698dfc9c99b34d7ed081ebcfbec4a8853868.zip
Added account dialog
Diffstat (limited to 'src/org/traccar/web/client/controller/LoginController.java')
-rw-r--r--src/org/traccar/web/client/controller/LoginController.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/org/traccar/web/client/controller/LoginController.java b/src/org/traccar/web/client/controller/LoginController.java
index d9795f30..d2b65ff5 100644
--- a/src/org/traccar/web/client/controller/LoginController.java
+++ b/src/org/traccar/web/client/controller/LoginController.java
@@ -16,8 +16,10 @@
package org.traccar.web.client.controller;
import org.traccar.web.client.Application;
+import org.traccar.web.client.ApplicationContext;
import org.traccar.web.client.model.BaseAsyncCallback;
import org.traccar.web.client.view.LoginDialog;
+import org.traccar.web.shared.model.User;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
@@ -58,10 +60,11 @@ public class LoginController implements LoginDialog.LoginHandler {
@Override
public void onLogin(String login, String password) {
if (validate(login, password)) {
- Application.getDataService().login(login, password, new BaseAsyncCallback<Boolean>() {
+ Application.getDataService().login(login, password, new BaseAsyncCallback<User>() {
@Override
- public void onSuccess(Boolean result) {
- if (result) {
+ public void onSuccess(User result) {
+ if (result != null) {
+ ApplicationContext.getInstance().setUser(result);
if (loginHandler != null) {
dialog.hide();
loginHandler.onLogin();
@@ -77,10 +80,11 @@ public class LoginController implements LoginDialog.LoginHandler {
@Override
public void onRegister(String login, String password) {
if (validate(login, password)) {
- Application.getDataService().register(login, password, new BaseAsyncCallback<Boolean>() {
+ Application.getDataService().register(login, password, new BaseAsyncCallback<User>() {
@Override
- public void onSuccess(Boolean result) {
- if (result) {
+ public void onSuccess(User result) {
+ if (result != null) {
+ ApplicationContext.getInstance().setUser(result);
if (loginHandler != null) {
dialog.hide();
loginHandler.onLogin();