diff options
author | Erik Johnston <erik@matrix.org> | 2014-08-15 11:50:14 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-08-15 11:50:14 +0100 |
commit | d72f897f078fa72548522440149369293f0d12b2 (patch) | |
tree | 4e8d692713f73389b89dea4fdba719b696c9f3af /webclient/app.js | |
parent | Reimplement the get public rooms api to work with new DB schema (diff) | |
parent | Add a check to make sure that during state conflict res we only request a PDU... (diff) | |
download | synapse-d72f897f078fa72548522440149369293f0d12b2.tar.xz |
Merge branch 'master' of github.com:matrix-org/synapse into sql_refactor
Conflicts: synapse/storage/stream.py
Diffstat (limited to 'webclient/app.js')
-rw-r--r-- | webclient/app.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/webclient/app.js b/webclient/app.js index 651aeeaa77..0b613fa206 100644 --- a/webclient/app.js +++ b/webclient/app.js @@ -23,8 +23,8 @@ var matrixWebClient = angular.module('matrixWebClient', [ 'matrixService' ]); -matrixWebClient.config(['$routeProvider', - function($routeProvider) { +matrixWebClient.config(['$routeProvider', '$provide', '$httpProvider', + function($routeProvider, $provide, $httpProvider) { $routeProvider. when('/login', { templateUrl: 'login/login.html', @@ -41,6 +41,22 @@ matrixWebClient.config(['$routeProvider', otherwise({ redirectTo: '/rooms' }); + + $provide.factory('AccessTokenInterceptor', ['$q', '$rootScope', + function ($q, $rootScope) { + return { + responseError: function(rejection) { + if (rejection.status === 403 && "data" in rejection && + "errcode" in rejection.data && + rejection.data.errcode === "M_UNKNOWN_TOKEN") { + console.log("Got a 403 with an unknown token. Logging out.") + $rootScope.$broadcast("M_UNKNOWN_TOKEN"); + } + return $q.reject(rejection); + } + }; + }]); + $httpProvider.interceptors.push('AccessTokenInterceptor'); }]); matrixWebClient.run(['$location', 'matrixService' , function($location, matrixService) { @@ -75,4 +91,4 @@ matrixWebClient return function(text) { return $sce.trustAsHtml(text); }; - }]); \ No newline at end of file + }]); |