diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-06 09:53:50 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-06 09:53:50 +1300 |
commit | 94d9ab6b5857cc5638f07155a6b45403dbc468bf (patch) | |
tree | 93cba417a5ee10798ae852568dc156ff8addb9ab | |
parent | 939a75a9378328bd6acae260e745d44f031d5ff0 (diff) | |
download | trackermap-web-94d9ab6b5857cc5638f07155a6b45403dbc468bf.tar.gz trackermap-web-94d9ab6b5857cc5638f07155a6b45403dbc468bf.tar.bz2 trackermap-web-94d9ab6b5857cc5638f07155a6b45403dbc468bf.zip |
Make login flow nicer
-rw-r--r-- | web/app/controller/Root.js | 2 | ||||
-rw-r--r-- | web/app/view/LoginController.js | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 81be05a5..eaf98e8f 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -34,7 +34,6 @@ Ext.define('Traccar.controller.Root', { }, onServerReturn: function (options, success, response) { - Ext.get('spinner').remove(); if (success) { Traccar.app.setServer(Ext.decode(response.responseText)); Ext.Ajax.request({ @@ -48,6 +47,7 @@ Ext.define('Traccar.controller.Root', { }, onSessionReturn: function (options, success, response) { + Ext.get('spinner').setVisible(false); if (success) { Traccar.app.setUser(Ext.decode(response.responseText)); this.loadApp(); diff --git a/web/app/view/LoginController.js b/web/app/view/LoginController.js index e175c0c3..fbc703e9 100644 --- a/web/app/view/LoginController.js +++ b/web/app/view/LoginController.js @@ -32,14 +32,15 @@ Ext.define('Traccar.view.LoginController', { login: function () { var form = this.lookupReference('form'); if (form.isValid()) { - Ext.getBody().mask(Strings.sharedLoading); + Ext.get('spinner').setVisible(true); + this.getView().setVisible(false); Ext.Ajax.request({ scope: this, method: 'POST', url: 'api/session', params: form.getValues(), callback: function (options, success, response) { - Ext.getBody().unmask(); + Ext.get('spinner').setVisible(false); if (success) { if (this.lookupReference('rememberField').getValue()) { Ext.util.Cookies.set('user', this.lookupReference('userField').getValue(), Ext.Date.add(new Date(), Ext.Date.YEAR, 1)); @@ -48,6 +49,7 @@ Ext.define('Traccar.view.LoginController', { Traccar.app.setUser(Ext.decode(response.responseText)); this.fireViewEvent('login'); } else { + this.getView().setVisible(true); Traccar.app.showError(Strings.loginFailed); } } |