aboutsummaryrefslogtreecommitdiff
path: root/web/app/LoginManager.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-01 11:30:44 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-01 11:30:44 +1200
commit8b68510d0f8c1baaad44d8b4011b92cf5efe76d9 (patch)
tree016012f3e525a21000282331f8246a76219ab7e1 /web/app/LoginManager.js
parent670acf03fb75e56fc0efc0c1fcfac04060bfb985 (diff)
downloadtrackermap-server-8b68510d0f8c1baaad44d8b4011b92cf5efe76d9.tar.gz
trackermap-server-8b68510d0f8c1baaad44d8b4011b92cf5efe76d9.tar.bz2
trackermap-server-8b68510d0f8c1baaad44d8b4011b92cf5efe76d9.zip
Store current user model
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]);
}