mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-18 20:31:30 +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 => {
|
}, err => {
|
||||||
if (err.status === 401) {
|
if (err.status === 401) {
|
||||||
this.sendToLogin();
|
this.sendToLogin();
|
||||||
|
this.token = null;
|
||||||
|
this.resetHttpParams();
|
||||||
}
|
}
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
@@ -414,14 +416,7 @@ export class PostsService implements CanActivate {
|
|||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// resets http params
|
this.resetHttpParams();
|
||||||
this.http_params = `apiKey=${this.auth_token}&sessionID=${this.session_id}`
|
|
||||||
|
|
||||||
this.httpOptions = {
|
|
||||||
params: new HttpParams({
|
|
||||||
fromString: this.http_params
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// user methods
|
// user methods
|
||||||
@@ -446,6 +441,17 @@ export class PostsService implements CanActivate {
|
|||||||
this.openSnackBar('You must log in to access this page!');
|
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() {
|
setInitialized() {
|
||||||
this.service_initialized.next(true);
|
this.service_initialized.next(true);
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user