Refactor logging in LoginController, simplify auth.service token validation, and remove debug logs from AppealComponent.
This commit is contained in:
@@ -164,9 +164,7 @@ export class AppealComponent implements OnInit, AfterViewInit {
|
||||
|
||||
public nextPage() {
|
||||
if (this.currentPageIndex === this.totalPages.length - 1) {
|
||||
console.log('Adding page');
|
||||
this.totalPages.push(this.currentPageIndex + 1);
|
||||
console.log(this.totalPages);
|
||||
}
|
||||
this.goToPage(this.currentPageIndex + 1);
|
||||
}
|
||||
|
||||
@@ -72,23 +72,23 @@ export class AuthService {
|
||||
*/
|
||||
public checkAuthStatus(): boolean {
|
||||
const jwt = this.getJwt();
|
||||
if (jwt) {
|
||||
try {
|
||||
// Check if token is expired
|
||||
if (this.jwtHelper.isTokenExpired(jwt)) {
|
||||
this.logout();
|
||||
return false;
|
||||
}
|
||||
|
||||
const claims = this.extractJwtClaims(jwt);
|
||||
console.log("User claims: ", claims);
|
||||
this.userClaimsSubject.next(claims);
|
||||
this.isAuthenticatedSubject.next(true);
|
||||
this.reloadUsername();
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (!jwt) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
if (this.jwtHelper.isTokenExpired(jwt)) {
|
||||
this.logout();
|
||||
return false;
|
||||
}
|
||||
|
||||
const claims = this.extractJwtClaims(jwt);
|
||||
console.log("User claims: ", claims);
|
||||
this.userClaimsSubject.next(claims);
|
||||
this.isAuthenticatedSubject.next(true);
|
||||
this.reloadUsername();
|
||||
return true;
|
||||
} catch (e) {
|
||||
this.logout();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user