mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-07 20:10:03 +03:00
Fixes bug where cached JWT token could prevent default admin creation
This commit is contained in:
@@ -398,6 +398,8 @@ export class PostsService implements CanActivate {
|
||||
}, err => {
|
||||
if (err.status === 401) {
|
||||
this.sendToLogin();
|
||||
this.token = null;
|
||||
this.resetHttpParams();
|
||||
}
|
||||
console.log(err);
|
||||
});
|
||||
@@ -414,14 +416,7 @@ export class PostsService implements CanActivate {
|
||||
this.router.navigate(['/login']);
|
||||
}
|
||||
|
||||
// resets http params
|
||||
this.http_params = `apiKey=${this.auth_token}&sessionID=${this.session_id}`
|
||||
|
||||
this.httpOptions = {
|
||||
params: new HttpParams({
|
||||
fromString: this.http_params
|
||||
}),
|
||||
};
|
||||
this.resetHttpParams();
|
||||
}
|
||||
|
||||
// user methods
|
||||
@@ -446,6 +441,17 @@ export class PostsService implements CanActivate {
|
||||
this.openSnackBar('You must log in to access this page!');
|
||||
}
|
||||
|
||||
resetHttpParams() {
|
||||
// resets http params
|
||||
this.http_params = `apiKey=${this.auth_token}&sessionID=${this.session_id}`
|
||||
|
||||
this.httpOptions = {
|
||||
params: new HttpParams({
|
||||
fromString: this.http_params
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
setInitialized() {
|
||||
this.service_initialized.next(true);
|
||||
this.initialized = true;
|
||||
|
||||
Reference in New Issue
Block a user