diff --git a/src/abstractions/api.service.ts b/src/abstractions/api.service.ts index d6f9447b35..e34da705c2 100644 --- a/src/abstractions/api.service.ts +++ b/src/abstractions/api.service.ts @@ -52,7 +52,6 @@ export abstract class ApiService { setUrls: (urls: EnvironmentUrls) => void; postIdentityToken: (request: TokenRequest) => Promise; refreshIdentityToken: () => Promise; - postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise; getProfile: () => Promise; putProfile: (request: UpdateProfileRequest) => Promise; postEmailToken: (request: EmailTokenRequest) => Promise; @@ -100,4 +99,6 @@ export abstract class ApiService { putTwoFactorU2f: (request: UpdateTwoFactorU2fRequest) => Promise; putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise; postTwoFactorRecover: (request: TwoFactorRecoveryRequest) => Promise; + postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise; + postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise; } diff --git a/src/services/api.service.ts b/src/services/api.service.ts index 75b23c9ca7..525d765a66 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -139,12 +139,6 @@ export class ApiService implements ApiServiceAbstraction { } } - // Two Factor APIs - - postTwoFactorEmail(request: TwoFactorEmailRequest): Promise { - return this.send('POST', '/two-factor/send-email-login', request, false, false); - } - // Account APIs async getProfile(): Promise { @@ -283,7 +277,7 @@ export class ApiService implements ApiServiceAbstraction { return this.send('POST', '/organizations/' + organizationId + '/import', request, true, false); } - // Settings + // Settings APIs async getSettingsDomains(): Promise { const r = await this.send('GET', '/settings/domains', null, true, true); @@ -295,7 +289,7 @@ export class ApiService implements ApiServiceAbstraction { return new DomainsResponse(r); } - // Two-factor + // Two-factor APIs async getTwoFactorProviders(): Promise> { const r = await this.send('GET', '/two-factor', null, true, true); @@ -367,6 +361,14 @@ export class ApiService implements ApiServiceAbstraction { return this.send('POST', '/two-factor/recover', request, false, false); } + postTwoFactorEmailSetup(request: TwoFactorEmailRequest): Promise { + return this.send('POST', '/two-factor/send-email', request, true, false); + } + + postTwoFactorEmail(request: TwoFactorEmailRequest): Promise { + return this.send('POST', '/two-factor/send-email-login', request, false, false); + } + // Helpers private async send(method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, body: any,