Fix bug with redirect to login caused by fixed of role verification

This commit is contained in:
Konstantinos Triantafyllou 2022-10-25 15:31:59 +03:00
parent ac58161c93
commit 56a8a035cc
1 changed files with 16 additions and 16 deletions

View File

@ -104,12 +104,12 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
ngAfterViewInit() { ngAfterViewInit() {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user; this.user = user;
if (this.user) {
if (this.paramsSubscription instanceof Subscription) { if (this.paramsSubscription instanceof Subscription) {
this.paramsSubscription.unsubscribe(); this.paramsSubscription.unsubscribe();
} }
this.paramsSubscription = this.route.queryParams.subscribe(params => { this.paramsSubscription = this.route.queryParams.subscribe(params => {
if (params && params['verify']) { if (params && params['verify']) {
if (this.user) {
this.subscriptions.push(this.userRegistryService.getInvitation(params['verify']).subscribe(verification => { this.subscriptions.push(this.userRegistryService.getInvitation(params['verify']).subscribe(verification => {
this.verification = verification; this.verification = verification;
if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) { if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) {
@ -126,8 +126,6 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
}, error => { }, error => {
this.openErrorModal(); this.openErrorModal();
})); }));
}
});
} else { } else {
this.router.navigate(['/user-info'], { this.router.navigate(['/user-info'], {
queryParams: { queryParams: {
@ -136,6 +134,8 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
} }
}); });
} }
}
});
})); }));
} }