Skip to content

Commit

Permalink
Merge pull request #7148 from olicooper/pr/angular-auth-guard
Browse files Browse the repository at this point in the history
angular: Fix AuthGuard returning 'true' when user not authorized
  • Loading branch information
mehmet-erim authored Jan 12, 2021
2 parents 051f1f3 + 50be0e4 commit fc98098
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export class AuthGuard implements CanActivate {
}

this.authService.initLogin();
return true;
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('AuthGuard', () => {
spectator.inject(OAuthService).hasValidAccessToken.andReturn(false);
const initLoginSpy = jest.spyOn(authService, 'initLogin');

expect(guard.canActivate()).toBe(true);
expect(guard.canActivate()).toBe(false);
expect(initLoginSpy).toHaveBeenCalled();
});
});

0 comments on commit fc98098

Please sign in to comment.