Skip to content

Commit

Permalink
fix: display login modal after authentication token has expired (#1280,
Browse files Browse the repository at this point in the history
#1311)

Closes: #1280
  • Loading branch information
SGrueber authored Nov 1, 2022
1 parent 1cae0d8 commit 025818c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/app/core/guards/login.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class LoginGuard implements CanActivate {

const loginModalComponent = this.currentDialog.componentInstance as LoginModalComponent;
loginModalComponent.loginMessageKey = route.queryParamMap.get('messageKey');
loginModalComponent.detectChanges();

// dialog closed
loginModalComponent.closeModal.pipe(first()).subscribe(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ <h2 class="modal-title">{{ 'account.login.signin.heading' | translate }}</h2>
[title]="'dialog.close.text' | translate"
[attr.aria-label]="'dialog.close.text' | translate"
(click)="hide()"
ngbAutofocus
>
<span aria-hidden="true">&times;</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';

@Component({
selector: 'ish-login-modal',
Expand All @@ -9,6 +9,12 @@ export class LoginModalComponent {
@Input() loginMessageKey: string;
@Output() closeModal = new EventEmitter<void>();

constructor(private cdRef: ChangeDetectorRef) {}

detectChanges() {
this.cdRef.detectChanges();
}

hide() {
this.closeModal.emit();
}
Expand Down

0 comments on commit 025818c

Please sign in to comment.