Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: display login modal after authentication token has expired #1311

Merged
merged 1 commit into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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