Feature/cli fail login on captcha request (#439)
* Fail CLI login if captcha is required by the server. * Linter fixes
This commit is contained in:
parent
e1ce721364
commit
ecdd08624f
|
@ -835,7 +835,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||||
}
|
}
|
||||||
|
|
||||||
async postOrganizationUserBulkConfirm(organizationId: string, request: OrganizationUserBulkConfirmRequest): Promise<ListResponse<OrganizationUserBulkResponse>> {
|
async postOrganizationUserBulkConfirm(organizationId: string, request: OrganizationUserBulkConfirmRequest): Promise<ListResponse<OrganizationUserBulkResponse>> {
|
||||||
const r = await this.send('POST', '/organizations/' + organizationId + '/users/confirm', request, true, true);
|
const r = await this.send('POST', '/organizations/' + organizationId + '/users/confirm', request, true, true);
|
||||||
return new ListResponse(r, OrganizationUserBulkResponse);
|
return new ListResponse(r, OrganizationUserBulkResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1262,7 +1262,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||||
}
|
}
|
||||||
|
|
||||||
async postProviderUserBulkConfirm(providerId: string, request: ProviderUserBulkConfirmRequest): Promise<ListResponse<ProviderUserBulkResponse>> {
|
async postProviderUserBulkConfirm(providerId: string, request: ProviderUserBulkConfirmRequest): Promise<ListResponse<ProviderUserBulkResponse>> {
|
||||||
const r = await this.send('POST', '/providers/' + providerId + '/users/confirm', request, true, true);
|
const r = await this.send('POST', '/providers/' + providerId + '/users/confirm', request, true, true);
|
||||||
return new ListResponse(r, ProviderUserBulkResponse);
|
return new ListResponse(r, ProviderUserBulkResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,10 @@ export class LoginCommand {
|
||||||
} else {
|
} else {
|
||||||
response = await this.authService.logIn(email, password);
|
response = await this.authService.logIn(email, password);
|
||||||
}
|
}
|
||||||
|
if (response.captchaSiteKey) {
|
||||||
|
return Response.badRequest('Your authentication request appears to be coming from a bot\n' +
|
||||||
|
'Please log in using your API key (https://bitwarden.com/help/article/cli/#using-an-api-key)');
|
||||||
|
}
|
||||||
if (response.twoFactor) {
|
if (response.twoFactor) {
|
||||||
let selectedProvider: any = null;
|
let selectedProvider: any = null;
|
||||||
const twoFactorProviders = this.authService.getSupportedTwoFactorProviders(null);
|
const twoFactorProviders = this.authService.getSupportedTwoFactorProviders(null);
|
||||||
|
|
Loading…
Reference in New Issue