PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782)

This commit is contained in:
Federico Maccaroni 2022-04-28 13:18:26 -03:00 committed by GitHub
parent fe65a337c8
commit e4687b4cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import * as DuoWebSDK from "duo_web_sdk";
import { first } from "rxjs/operators"; import { first } from "rxjs/operators";
import { ApiService } from "jslib-common/abstractions/api.service"; 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 { AuthService } from "jslib-common/abstractions/auth.service";
import { EnvironmentService } from "jslib-common/abstractions/environment.service"; import { EnvironmentService } from "jslib-common/abstractions/environment.service";
import { I18nService } from "jslib-common/abstractions/i18n.service"; import { I18nService } from "jslib-common/abstractions/i18n.service";
@ -57,7 +58,8 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
protected stateService: StateService, protected stateService: StateService,
protected route: ActivatedRoute, protected route: ActivatedRoute,
protected logService: LogService, protected logService: LogService,
protected twoFactorService: TwoFactorService protected twoFactorService: TwoFactorService,
protected appIdService: AppIdService
) { ) {
super(environmentService, i18nService, platformUtilsService); super(environmentService, i18nService, platformUtilsService);
this.webAuthnSupported = this.platformUtilsService.supportsWebAuthn(win); this.webAuthnSupported = this.platformUtilsService.supportsWebAuthn(win);
@ -234,6 +236,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
const request = new TwoFactorEmailRequest(); const request = new TwoFactorEmailRequest();
request.email = this.authService.email; request.email = this.authService.email;
request.masterPasswordHash = this.authService.masterPasswordHash; request.masterPasswordHash = this.authService.masterPasswordHash;
request.deviceIdentifier = await this.appIdService.getAppId();
this.emailPromise = this.apiService.postTwoFactorEmail(request); this.emailPromise = this.apiService.postTwoFactorEmail(request);
await this.emailPromise; await this.emailPromise;
if (doToast) { if (doToast) {

View File

@ -2,4 +2,5 @@ import { SecretVerificationRequest } from "./secretVerificationRequest";
export class TwoFactorEmailRequest extends SecretVerificationRequest { export class TwoFactorEmailRequest extends SecretVerificationRequest {
email: string; email: string;
deviceIdentifier: string;
} }