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

Pdip 1114 mfa polish #638

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<app-breadcrumb [breadcrumbs]="breadcrumbsData"></app-breadcrumb>
<div class="content-box">
<header>
<h1>BC Provider Account Management</h1>
<h1>BCProvider Account Management</h1>
<h3>Set a new password or reset your MFA at your convenience</h3>
</header>
<ng-container *ngIf="showErrorCard">
Expand Down Expand Up @@ -95,7 +95,7 @@ <h1><strong>Set new password</strong></h1>
(click)="toggleTooltip('mfa')"></fa-icon>
</div>
<h1>
<strong>Reset your multifactor authentication (MFA)</strong>
<strong>Reset your multi-factor authentication (MFA)</strong>
</h1>
<p class="mfa-disclaimer">Only available if you login with BCSC</p>
<div class="mfa-content-boxes">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
--header-margin: unset;
--avatar-size: 4rem;
--content-padding: var(--gap);
ul li{
list-style-type: decimal;
}
}

.viewport-medium {
Expand Down
24 changes: 24 additions & 0 deletions workspace/apps/pidp/src/app/features/faq/pages/help/help.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,30 @@ <h1>Frequently asked questions</h1>
</p>
</mat-expansion-panel>
</div>
<div class="faq-item">
<mat-expansion-panel
class="faq-expansion-panel"
(opened)="panelOpenState.set(true)"
(closed)="panelOpenState.set(false)">
<mat-expansion-panel-header>
<mat-panel-title
><b
>How do I reset my MFA on BCProvider?</b
></mat-panel-title
>
</mat-expansion-panel-header>
<ul>
<li>Click Access</li>
<li>Click BC Provider Account</li>
<li>On the right-hand side click “Reset my MFA” link</li>
<li>Click continue, system will unpair your phone</li>
<li>After completely the unpairing, you will be prompted to login</li>
<li>Select the BCprovider acccount</li>
<li>Enter your current password</li>
<li>After successfully logging into your account, you will be prompted to setup MFA on a phone or tablet.</li>
</ul>
</mat-expansion-panel>
</div>
<div class="faq-item">
<mat-expansion-panel
class="faq-expansion-panel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
(click)="navigateTo(ProfileRoutes.routePath(ProfileRoutes.USER_ACCESS_AGREEMENT))"
>User Access Agreement</a
>
<a
*ngIf="hasCredential(IdentityProvider.BC_PROVIDER)"
class="dropdown-links"
(click)="navigateTo(AccessRoutes.routePath(AccessRoutes.BC_PROVIDER_EDIT))"
>Password and MFA reset</a
>
</div>
</div>
</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { IdentityProvider } from '@app/features/auth/enums/identity-provider.enum';

export interface Credential {
id: number;
identityProvider: IdentityProvider;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { HttpErrorResponse } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { ApiHttpClient } from "@app/core/resources/api-http-client.service";
import { catchError, Observable, throwError } from "rxjs";
import { Credential } from "./nav-menu.model";

@Injectable({
providedIn: 'root',
})
export class NavMenuResource {
public constructor(
protected apiResource: ApiHttpClient
) {}

public getCredentials(partyId: number): Observable<Credential[]> {
return this.apiResource
.get<Credential[]>(this.getResourcePath(partyId))
.pipe(
catchError((error: HttpErrorResponse) => {
return throwError(() => error);
}),
);
}

protected getResourcePath(partyId: number): string {
return `parties/${partyId}/credentials`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
EventEmitter,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges,
ViewChild,
Expand Down Expand Up @@ -39,6 +40,12 @@

import { AlertCode } from '@app/features/portal/enums/alert-code.enum';
import { ProfileRoutes } from '@app/features/profile/profile.routes';
import { AccessRoutes } from '@app/features/access/access.routes';
import { NavMenuResource } from './nav-menu.resource.service';
import { PartyService } from '@app/core/party/party.service';
import { Observable, Subject, takeUntil } from 'rxjs';
import { IdentityProvider } from '@app/features/auth/enums/identity-provider.enum';
import { Credential } from './nav-menu.model';

@Component({
selector: 'app-nav-menu',
Expand All @@ -62,7 +69,7 @@
NgClass,
],
})
export class NavMenuComponent implements OnChanges {
export class NavMenuComponent implements OnChanges, OnInit {
@Input() public alerts: AlertCode[] | null = [];
@Input() public menuItems!: DashboardMenuItem[];
@Input() public emailSupport!: string;
Expand All @@ -79,21 +86,41 @@
public isLogoutMenuItemVisible = false;
public isTopMenuVisible = false;
public ProfileRoutes = ProfileRoutes;
public AccessRoutes = AccessRoutes;
public showCollegeAlert = false;
public faBell = faBell;
public AlertCode = AlertCode;
public credentials: Credential[] = [];
public credentials$: Observable<Credential[]>;
private unsubscribe$ = new Subject<void>();
public IdentityProvider = IdentityProvider;

public constructor(
private viewportService: ViewportService,
private router: Router,
private resource: NavMenuResource,
private partyService: PartyService,
) {
this.viewportService.viewportBroadcast$.subscribe((viewport) =>
this.onViewportChange(viewport),
);
const partyId = this.partyService.partyId;
this.credentials$ = this.resource.getCredentials(partyId);
}

public ngOnInit(): void {
this.handleLinkedAccounts();
}

public ngOnChanges(_: SimpleChanges): void {
this.refresh();
}

public ngOnDestroy(): void {

Check warning on line 119 in workspace/apps/pidp/src/app/features/shell/components/navbar-menu/nav-menu.ts

View workflow job for this annotation

GitHub Actions / Frontend Yarn Lint

Lifecycle interface 'OnDestroy' should be implemented for method 'ngOnDestroy'. (https://angular.io/styleguide#style-09-01)

Check warning on line 119 in workspace/apps/pidp/src/app/features/shell/components/navbar-menu/nav-menu.ts

View workflow job for this annotation

GitHub Actions / Frontend Yarn Lint

Lifecycle interface 'OnDestroy' should be implemented for method 'ngOnDestroy'. (https://angular.io/styleguide#style-09-01)
this.unsubscribe$.next();
this.unsubscribe$.complete();
}

public onMiniMenuButtonClick(): void {
// Toggle display of the sidenav.
this.isSidenavOpened = !this.isSidenavOpened;
Expand Down Expand Up @@ -137,6 +164,11 @@
}
return undefined;
}

public hasCredential(idp: IdentityProvider): boolean {
return this.credentials.some((c) => c.identityProvider === idp);
}

public onLogout(): void {
this.logout.emit();
}
Expand All @@ -146,6 +178,14 @@
}
}

private handleLinkedAccounts(): void {
this.credentials$
.pipe(takeUntil(this.unsubscribe$))
.subscribe((credentials) => {
this.credentials = credentials;
});
}

private onViewportChange(viewport: PidpViewport): void {
this.viewport = viewport;
this.refresh();
Expand Down
Loading