thinkster-django-angular
thinkster-django-angular copied to clipboard
Authentication.getAuthenticatedAccount() not working
on account settings controller, it wont let me access the settings page when I am logged in to an account
function activate() {
var authenticatedAccount = Authentication.getAuthenticatedAccount();
var username = $routeParams.username.substr(1);
console.log(authenticatedAccount); // returns undefined
console.log(username);
// Redirect if not logged in
if (!authenticatedAccount) {
$location.url('/');
Snackbar.error('You are not authorized to view this page.');
} else {
// Redirect if logged in, but not the owner of this account.
if (authenticatedAccount.username !== username) {
debugger;
$location.url('/');
Snackbar.error('You are not authorized to view this page.');
}
}