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.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/web/app/LoginManager.js b/web/app/LoginManager.js
index 89df7684f..914b7d6a9 100644
--- a/web/app/LoginManager.js
+++ b/web/app/LoginManager.js
@@ -16,6 +16,14 @@
Ext.define('Traccar.LoginManager', {
singleton: true,
+
+ setUser: function(data) {
+ var reader = Ext.create('Ext.data.reader.Json', {
+ model: 'Traccar.model.User'
+ });
+ Traccar.getApplication().setUser(
+ reader.readRecords(data).getRecords()[0]);
+ },
session: function(options) {
Ext.Ajax.request({
@@ -31,7 +39,7 @@ Ext.define('Traccar.LoginManager', {
if (Traccar.ErrorManager.check(success, response)) {
var result = Ext.decode(response.responseText);
if (result.success) {
- this.user = result.data;
+ this.setUser(result.data);
}
Ext.callback(options.callback, options.scope, [result.success]);
}
@@ -52,7 +60,7 @@ Ext.define('Traccar.LoginManager', {
if (Traccar.ErrorManager.check(success, response)) {
var result = Ext.decode(response.responseText);
if (result.success) {
- this.user = result.data;
+ this.setUser(result.data);
}
Ext.callback(options.callback, options.scope, [result.success]);
}