From be60c87c9b5333e847c85d109484c431d5651562 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 18 Nov 2016 18:11:04 +0500 Subject: Cleanup token parsing --- web/app/controller/Root.js | 11 ++++++----- 1 file 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 { -- cgit v1.2.3