aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-11-06 09:53:50 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-11-06 09:53:50 +1300
commit94d9ab6b5857cc5638f07155a6b45403dbc468bf (patch)
tree93cba417a5ee10798ae852568dc156ff8addb9ab
parent939a75a9378328bd6acae260e745d44f031d5ff0 (diff)
downloadetbsa-traccar-web-94d9ab6b5857cc5638f07155a6b45403dbc468bf.tar.gz
etbsa-traccar-web-94d9ab6b5857cc5638f07155a6b45403dbc468bf.tar.bz2
etbsa-traccar-web-94d9ab6b5857cc5638f07155a6b45403dbc468bf.zip
Make login flow nicer
-rw-r--r--web/app/controller/Root.js2
-rw-r--r--web/app/view/LoginController.js6
2 files changed, 5 insertions, 3 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 81be05a..eaf98e8 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 e175c0c..fbc703e 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);
}
}