mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-26 17:09:23 -05:00
Do not start the event stream if the user is not logged in (=if he does not has an access token yet)
Add isUserLoggedIn to check this.
This commit is contained in:
parent
d5bebc9eaa
commit
0b5674ccc5
@ -52,7 +52,7 @@ angular.module('MatrixWebClientController', ['matrixService'])
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (matrixService.config()) {
|
if (matrixService.isUserLoggedIn()) {
|
||||||
eventStreamService.resume();
|
eventStreamService.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,8 @@ matrixWebClient.config(['$routeProvider', '$provide', '$httpProvider',
|
|||||||
}]);
|
}]);
|
||||||
|
|
||||||
matrixWebClient.run(['$location', 'matrixService', 'eventStreamService', function($location, matrixService, eventStreamService) {
|
matrixWebClient.run(['$location', 'matrixService', 'eventStreamService', function($location, matrixService, eventStreamService) {
|
||||||
// If we have no persistent login information, go to the login page
|
// If user auth details are not in cache, go to the login page
|
||||||
var config = matrixService.config();
|
if (!matrixService.isUserLoggedIn()) {
|
||||||
if (!config || !config.access_token) {
|
|
||||||
eventStreamService.stop();
|
eventStreamService.stop();
|
||||||
$location.path("login");
|
$location.path("login");
|
||||||
}
|
}
|
||||||
|
@ -318,12 +318,21 @@ angular.module('matrixService', [])
|
|||||||
};
|
};
|
||||||
return doRequest("GET", path, params);
|
return doRequest("GET", path, params);
|
||||||
},
|
},
|
||||||
|
|
||||||
//
|
// Indicates if user authentications details are stored in cache
|
||||||
testLogin: function() {
|
isUserLoggedIn: function() {
|
||||||
|
var config = this.config();
|
||||||
|
|
||||||
|
// User is considered logged in if his cache is not empty and contains
|
||||||
|
// an access token
|
||||||
|
if (config && config.access_token) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/****** Permanent storage of user information ******/
|
/****** Permanent storage of user information ******/
|
||||||
|
|
||||||
// Returns the current config
|
// Returns the current config
|
||||||
|
Loading…
Reference in New Issue
Block a user