aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-11-18 18:11:04 +0500
committerAbyss777 <abyss@fox5.ru>2016-11-18 18:11:04 +0500
commitbe60c87c9b5333e847c85d109484c431d5651562 (patch)
tree575aa630f31711facc6009de4f7f8b0b00031c96 /web
parent38d94e65e9bb46cc10cbe7559daa41d1468ba853 (diff)
downloadtrackermap-web-be60c87c9b5333e847c85d109484c431d5651562.tar.gz
trackermap-web-be60c87c9b5333e847c85d109484c431d5651562.tar.bz2
trackermap-web-be60c87c9b5333e847c85d109484c431d5651562.zip
Cleanup token parsing
Diffstat (limited to 'web')
-rw-r--r--web/app/controller/Root.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index adc188c0..e30446c9 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -34,17 +34,18 @@ Ext.define('Traccar.controller.Root', {
},
onServerReturn: function (options, success, response) {
- var tokenParameter;
+ var token, parameters = {};
if (success) {
Traccar.app.setServer(Ext.decode(response.responseText));
- tokenParameter = window.location.search.match('token=([a-zA-Z0-9]+)');
+ token = Ext.Object.fromQueryString(window.location.search).token;
+ if (token) {
+ parameters.token = token;
+ }
Ext.Ajax.request({
scope: this,
url: 'api/session',
method: 'GET',
- params: tokenParameter !== null ? {
- token: tokenParameter[1]
- } : {},
+ params: parameters,
callback: this.onSessionReturn
});
} else {