aboutsummaryrefslogtreecommitdiff
path: root/web/app/LoginManager.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/LoginManager.js')
-rw-r--r--web/app/LoginManager.js42
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();
}
});