diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-17 16:57:31 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-17 16:57:31 +1200 |
commit | 8baf73493d24c85bc5d13069044fc1150ed62c2e (patch) | |
tree | ce421f9431ac3e13e91817bfd989bcd272034649 /web/app/LoginManager.js | |
parent | 4154c2cd31f23c5d5fb336dfcd68ba192b297f93 (diff) | |
download | traccar-server-8baf73493d24c85bc5d13069044fc1150ed62c2e.tar.gz traccar-server-8baf73493d24c85bc5d13069044fc1150ed62c2e.tar.bz2 traccar-server-8baf73493d24c85bc5d13069044fc1150ed62c2e.zip |
Move login calls to controller
Diffstat (limited to 'web/app/LoginManager.js')
-rw-r--r-- | web/app/LoginManager.js | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/web/app/LoginManager.js b/web/app/LoginManager.js index 34069574b..0137ccf9c 100644 --- a/web/app/LoginManager.js +++ b/web/app/LoginManager.js @@ -17,13 +17,6 @@ Ext.define('Traccar.LoginManager', { singleton: true, - setUser: function(data) { - var reader = Ext.create('Ext.data.reader.Json', { - model: 'Traccar.model.User' - }); - Traccar.app.setUser(reader.readRecords(data).getRecords()[0]); - }, - server: function(options) { Ext.Ajax.request({ scope: this, @@ -61,43 +54,10 @@ Ext.define('Traccar.LoginManager', { if (Traccar.ErrorManager.check(success, response)) { var result = Ext.decode(response.responseText); if (result.success) { - this.setUser(result.data); + Traccar.app.setUser(result.data); } Ext.callback(options.callback, options.scope, [result.success]); } - }, - - login: function(options) { - Ext.Ajax.request({ - scope: this, - url: '/api/login', - params: options.data, - callback: this.onLoginReturn, - original: options - }); - }, - - onLoginReturn: function(options, success, response) { - options = options.original; - if (Traccar.ErrorManager.check(success, response)) { - var result = Ext.decode(response.responseText); - if (result.success) { - this.setUser(result.data); - } - Ext.callback(options.callback, options.scope, [result.success]); - } - }, - - logout: function() { - Ext.Ajax.request({ - scope: this, - url: '/api/logout', - callback: this.onLogoutReturn - }); - }, - - onLogoutReturn: function() { - window.location.reload(); } }); |