Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
PS-302 Added DeviceId to the 2FA email request and set it when callin…
Browse files Browse the repository at this point in the history
…g the endpoint that's needed to see if it's a 2FA email because of a new device (#782)
  • Loading branch information
fedemkr committed Apr 28, 2022
1 parent fe65a33 commit e4687b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion angular/src/components/two-factor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as DuoWebSDK from "duo_web_sdk";
import { first } from "rxjs/operators";

import { ApiService } from "jslib-common/abstractions/api.service";
import { AppIdService } from "jslib-common/abstractions/appId.service";
import { AuthService } from "jslib-common/abstractions/auth.service";
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
Expand Down Expand Up @@ -57,7 +58,8 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
protected stateService: StateService,
protected route: ActivatedRoute,
protected logService: LogService,
protected twoFactorService: TwoFactorService
protected twoFactorService: TwoFactorService,
protected appIdService: AppIdService
) {
super(environmentService, i18nService, platformUtilsService);
this.webAuthnSupported = this.platformUtilsService.supportsWebAuthn(win);
Expand Down Expand Up @@ -234,6 +236,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
const request = new TwoFactorEmailRequest();
request.email = this.authService.email;
request.masterPasswordHash = this.authService.masterPasswordHash;
request.deviceIdentifier = await this.appIdService.getAppId();
this.emailPromise = this.apiService.postTwoFactorEmail(request);
await this.emailPromise;
if (doToast) {
Expand Down
1 change: 1 addition & 0 deletions common/src/models/request/twoFactorEmailRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import { SecretVerificationRequest } from "./secretVerificationRequest";

export class TwoFactorEmailRequest extends SecretVerificationRequest {
email: string;
deviceIdentifier: string;
}

0 comments on commit e4687b4

Please sign in to comment.