diff options
author | Abyss777 <abyss@fox5.ru> | 2016-11-18 18:11:04 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-11-18 18:11:04 +0500 |
commit | be60c87c9b5333e847c85d109484c431d5651562 (patch) | |
tree | 575aa630f31711facc6009de4f7f8b0b00031c96 /web/app/controller | |
parent | 38d94e65e9bb46cc10cbe7559daa41d1468ba853 (diff) | |
download | trackermap-web-be60c87c9b5333e847c85d109484c431d5651562.tar.gz trackermap-web-be60c87c9b5333e847c85d109484c431d5651562.tar.bz2 trackermap-web-be60c87c9b5333e847c85d109484c431d5651562.zip |
Cleanup token parsing
Diffstat (limited to 'web/app/controller')
-rw-r--r-- | web/app/controller/Root.js | 11 |
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 { |