From e4bda402985e1cc82e6c0368d99c44fe5786059d Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 28 Apr 2014 12:08:51 +0800 Subject: [PATCH] Fixed session revoke Fix #252 --- app/js/controllers.js | 7 ++++--- app/js/lib/mtproto.js | 9 +++++++-- app/partials/error_modal.html | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/js/controllers.js b/app/js/controllers.js index 94da5082..ab23c252 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -21,7 +21,10 @@ angular.module('myApp.controllers', []) }); }) - .controller('AppLoginController', function ($scope, $location, $timeout, $modal, MtpApiManager, ErrorService) { + .controller('AppLoginController', function ($scope, $location, $timeout, $modal, $modalStack, MtpApiManager, ErrorService) { + + $modalStack.dismissAll(); + MtpApiManager.getUserID().then(function (id) { if (id) { $location.url('/im'); @@ -1712,8 +1715,6 @@ angular.module('myApp.controllers', []) results = SearchIndexManager.search(newValue, searchIndex); } - console.log(dT(), newValue, results); - $scope.countries = []; var j; for (var i = 0; i < Config.CountryCodes.length; i++) { diff --git a/app/js/lib/mtproto.js b/app/js/lib/mtproto.js index d323ea9c..2cf91869 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -775,7 +775,9 @@ TLDeserialization.prototype.fetchBool = function (field) { } else if (i == 0xbc799737) { return false } - throw new Error('Unknown Bool constructor ' + i); + + this.offset -= 4; + return this.fetchObject('Object', field); } TLDeserialization.prototype.fetchString = function (field) { @@ -2637,7 +2639,10 @@ factory('MtpApiManager', function (AppConfigManager, MtpAuthorizer, MtpNetworker }, function (error) { console.error(dT(), 'Error', error.code, error.type, baseDcID, dcID); - if (error.code == 401 && baseDcID && dcID != baseDcID) { + if (error.code == 401 && baseDcID == dcID) { + AppConfigManager.remove('dc', 'user_auth'); + } + else if (error.code == 401 && baseDcID && dcID != baseDcID) { if (cachedExportPromise[dcID] === undefined) { var exportDeferred = $q.defer(); diff --git a/app/partials/error_modal.html b/app/partials/error_modal.html index 58988646..3ff695bf 100644 --- a/app/partials/error_modal.html +++ b/app/partials/error_modal.html @@ -46,7 +46,7 @@
One of the params is missing or invalid. - This action requires authorization access. Please log in. + This action requires authorization access. Please log in. You are not allowed for this action. The page was not found. You are performing too many actions. Please try again later.