1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +01:00

u2f email send apis

This commit is contained in:
Kyle Spearrin 2018-06-27 17:50:12 -04:00
parent ec505b8c55
commit ccd10751e3
2 changed files with 12 additions and 9 deletions

View File

@ -52,7 +52,6 @@ export abstract class ApiService {
setUrls: (urls: EnvironmentUrls) => void;
postIdentityToken: (request: TokenRequest) => Promise<IdentityTokenResponse | IdentityTwoFactorResponse>;
refreshIdentityToken: () => Promise<any>;
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
getProfile: () => Promise<ProfileResponse>;
putProfile: (request: UpdateProfileRequest) => Promise<ProfileResponse>;
postEmailToken: (request: EmailTokenRequest) => Promise<any>;
@ -100,4 +99,6 @@ export abstract class ApiService {
putTwoFactorU2f: (request: UpdateTwoFactorU2fRequest) => Promise<TwoFactorU2fResponse>;
putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
postTwoFactorRecover: (request: TwoFactorRecoveryRequest) => Promise<any>;
postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise<any>;
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
}

View File

@ -139,12 +139,6 @@ export class ApiService implements ApiServiceAbstraction {
}
}
// Two Factor APIs
postTwoFactorEmail(request: TwoFactorEmailRequest): Promise<any> {
return this.send('POST', '/two-factor/send-email-login', request, false, false);
}
// Account APIs
async getProfile(): Promise<ProfileResponse> {
@ -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<DomainsResponse> {
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<ListResponse<TwoFactorProviderResponse>> {
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<any> {
return this.send('POST', '/two-factor/send-email', request, true, false);
}
postTwoFactorEmail(request: TwoFactorEmailRequest): Promise<any> {
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,