Browse Source

Fixed session revoke

Fix #252
master
Igor Zhukov 11 years ago
parent
commit
e4bda40298
  1. 7
      app/js/controllers.js
  2. 9
      app/js/lib/mtproto.js
  3. 2
      app/partials/error_modal.html

7
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) { MtpApiManager.getUserID().then(function (id) {
if (id) { if (id) {
$location.url('/im'); $location.url('/im');
@ -1712,8 +1715,6 @@ angular.module('myApp.controllers', [])
results = SearchIndexManager.search(newValue, searchIndex); results = SearchIndexManager.search(newValue, searchIndex);
} }
console.log(dT(), newValue, results);
$scope.countries = []; $scope.countries = [];
var j; var j;
for (var i = 0; i < Config.CountryCodes.length; i++) { for (var i = 0; i < Config.CountryCodes.length; i++) {

9
app/js/lib/mtproto.js

@ -775,7 +775,9 @@ TLDeserialization.prototype.fetchBool = function (field) {
} else if (i == 0xbc799737) { } else if (i == 0xbc799737) {
return false return false
} }
throw new Error('Unknown Bool constructor ' + i);
this.offset -= 4;
return this.fetchObject('Object', field);
} }
TLDeserialization.prototype.fetchString = function (field) { TLDeserialization.prototype.fetchString = function (field) {
@ -2637,7 +2639,10 @@ factory('MtpApiManager', function (AppConfigManager, MtpAuthorizer, MtpNetworker
}, },
function (error) { function (error) {
console.error(dT(), 'Error', error.code, error.type, baseDcID, dcID); 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) { if (cachedExportPromise[dcID] === undefined) {
var exportDeferred = $q.defer(); var exportDeferred = $q.defer();

2
app/partials/error_modal.html

@ -46,7 +46,7 @@
<div ng-switch-default ng-switch="error.code"> <div ng-switch-default ng-switch="error.code">
<span ng-switch-when="400">One of the params is missing or invalid.</span> <span ng-switch-when="400">One of the params is missing or invalid.</span>
<span ng-switch-when="401">This action requires authorization access. Please <a href="#/auth">log in</a>.</span> <span ng-switch-when="401">This action requires authorization access. Please <a href="#/login">log in</a>.</span>
<span ng-switch-when="403">You are not allowed for this action.</span> <span ng-switch-when="403">You are not allowed for this action.</span>
<span ng-switch-when="404">The page was not found.</span> <span ng-switch-when="404">The page was not found.</span>
<span ng-switch-when="420">You are performing too many actions. Please try again later.</span> <span ng-switch-when="420">You are performing too many actions. Please try again later.</span>

Loading…
Cancel
Save