blocking access on 401/403

This commit is contained in:
2021-04-29 05:29:54 +00:00
parent 77e0e9ff94
commit fb1c53946b
10 changed files with 173 additions and 123 deletions

View File

@@ -26,12 +26,11 @@ export class AuthComponent implements OnInit {
this.keyForm = this.formBuilder.group({
key: ['', Validators.required],
});
if (this.authService.privateKey !== undefined) {
const setKey = await this.authService.setKey(this.authService.privateKey);
if (setKey && this.authService.sessionToken !== undefined) {
this.authService.setState('Click button to log in');
}
}
await this.authService.init();
//if (this.authService.privateKey !== undefined) {
// const setKey = await this.authService.setKey(this.authService.privateKey);
// }
//}
}
get keyFormStub(): any { return this.keyForm.controls; }
@@ -47,8 +46,12 @@ export class AuthComponent implements OnInit {
}
login(): void {
const loginStatus = this.authService.login();
if (loginStatus) {
// TODO check if we have privatekey
// Send us to home if we have a private key
// talk to meta somehow
// in the error interceptor if 401/403 handle it
// if 200 go /home
if (this.authService.getPrivateKey()) {
this.router.navigate(['/home']);
}
}