mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
@@ -65,7 +65,7 @@ export class LoginCommand {
|
||||
protected keyConnectorService: KeyConnectorService,
|
||||
protected policyApiService: PolicyApiServiceAbstraction,
|
||||
protected orgService: OrganizationService,
|
||||
protected logoutCallback: () => Promise<void>
|
||||
protected logoutCallback: () => Promise<void>,
|
||||
) {}
|
||||
|
||||
async run(email: string, password: string, options: program.OptionValues) {
|
||||
@@ -179,7 +179,7 @@ export class LoginCommand {
|
||||
}
|
||||
try {
|
||||
response = await this.authService.logIn(
|
||||
new UserApiLoginCredentials(clientId, clientSecret)
|
||||
new UserApiLoginCredentials(clientId, clientSecret),
|
||||
);
|
||||
} catch (e) {
|
||||
// handle API key login failures
|
||||
@@ -201,17 +201,17 @@ export class LoginCommand {
|
||||
ssoCodeVerifier,
|
||||
this.ssoRedirectUri,
|
||||
orgIdentifier,
|
||||
twoFactor
|
||||
)
|
||||
twoFactor,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
response = await this.authService.logIn(
|
||||
new PasswordLoginCredentials(email, password, null, twoFactor)
|
||||
new PasswordLoginCredentials(email, password, null, twoFactor),
|
||||
);
|
||||
}
|
||||
if (response.requiresEncryptionKeyMigration) {
|
||||
return Response.error(
|
||||
"Encryption key migration required. Please login through the web vault to update your encryption key."
|
||||
"Encryption key migration required. Please login through the web vault to update your encryption key.",
|
||||
);
|
||||
}
|
||||
if (response.captchaSiteKey) {
|
||||
@@ -294,7 +294,7 @@ export class LoginCommand {
|
||||
|
||||
response = await this.authService.logInTwoFactor(
|
||||
new TokenTwoFactorRequest(selectedProvider.type, twoFactorToken),
|
||||
null
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ export class LoginCommand {
|
||||
if (response.resetMasterPassword) {
|
||||
return Response.error(
|
||||
"In order to log in with SSO from the CLI, you must first log in" +
|
||||
" through the web vault to set your master password."
|
||||
" through the web vault to set your master password.",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ export class LoginCommand {
|
||||
) {
|
||||
const res = new MessageResponse(
|
||||
"You are logged in!",
|
||||
"\n" + "To unlock your vault, use the `unlock` command. ex:\n" + "$ bw unlock"
|
||||
"\n" + "To unlock your vault, use the `unlock` command. ex:\n" + "$ bw unlock",
|
||||
);
|
||||
return Response.success(res);
|
||||
}
|
||||
@@ -375,7 +375,7 @@ export class LoginCommand {
|
||||
'"\n\n' +
|
||||
"You can also pass the session key to any command with the `--session` option. ex:\n" +
|
||||
"$ bw list items --session " +
|
||||
process.env.BW_SESSION
|
||||
process.env.BW_SESSION,
|
||||
);
|
||||
res.raw = process.env.BW_SESSION;
|
||||
return Response.success(res);
|
||||
@@ -389,7 +389,7 @@ export class LoginCommand {
|
||||
|
||||
const res = new MessageResponse(
|
||||
"Your master password has been updated!",
|
||||
"\n" + "You have been logged out and must log in again to access the vault."
|
||||
"\n" + "You have been logged out and must log in again to access the vault.",
|
||||
);
|
||||
|
||||
return Response.success(res);
|
||||
@@ -405,14 +405,14 @@ export class LoginCommand {
|
||||
return Response.error(
|
||||
new MessageResponse(
|
||||
"Your master password does not meet one or more of your organization policies. In order to access the vault, you must update your master password now via the web vault. You have been logged out.",
|
||||
null
|
||||
)
|
||||
null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { newPasswordHash, newUserKey, hint } = await this.collectNewMasterPasswordDetails(
|
||||
"Your master password does not meet one or more of your organization policies. In order to access the vault, you must update your master password now."
|
||||
"Your master password does not meet one or more of your organization policies. In order to access the vault, you must update your master password now.",
|
||||
);
|
||||
|
||||
const request = new PasswordRequest();
|
||||
@@ -443,14 +443,14 @@ export class LoginCommand {
|
||||
return Response.error(
|
||||
new MessageResponse(
|
||||
"An organization administrator recently changed your master password. In order to access the vault, you must update your master password now via the web vault. You have been logged out.",
|
||||
null
|
||||
)
|
||||
null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const { newPasswordHash, newUserKey, hint } = await this.collectNewMasterPasswordDetails(
|
||||
"An organization administrator recently changed your master password. In order to access the vault, you must update your master password now."
|
||||
"An organization administrator recently changed your master password. In order to access the vault, you must update your master password now.",
|
||||
);
|
||||
|
||||
const request = new UpdateTempPasswordRequest();
|
||||
@@ -479,7 +479,7 @@ export class LoginCommand {
|
||||
*/
|
||||
private async collectNewMasterPasswordDetails(
|
||||
prompt: string,
|
||||
error?: string
|
||||
error?: string,
|
||||
): Promise<{
|
||||
newPasswordHash: string;
|
||||
newUserKey: [SymmetricCryptoKey, EncString];
|
||||
@@ -507,18 +507,18 @@ export class LoginCommand {
|
||||
if (masterPassword.length < Utils.minimumPasswordLength) {
|
||||
return this.collectNewMasterPasswordDetails(
|
||||
prompt,
|
||||
`Master password must be at least ${Utils.minimumPasswordLength} characters long.\n`
|
||||
`Master password must be at least ${Utils.minimumPasswordLength} characters long.\n`,
|
||||
);
|
||||
}
|
||||
|
||||
// Strength & Policy Validation
|
||||
const strengthResult = this.passwordStrengthService.getPasswordStrength(
|
||||
masterPassword,
|
||||
this.email
|
||||
this.email,
|
||||
);
|
||||
|
||||
const enforcedPolicyOptions = await firstValueFrom(
|
||||
this.policyService.masterPasswordPolicyOptions$()
|
||||
this.policyService.masterPasswordPolicyOptions$(),
|
||||
);
|
||||
|
||||
// Verify master password meets policy requirements
|
||||
@@ -527,12 +527,12 @@ export class LoginCommand {
|
||||
!this.policyService.evaluateMasterPassword(
|
||||
strengthResult.score,
|
||||
masterPassword,
|
||||
enforcedPolicyOptions
|
||||
enforcedPolicyOptions,
|
||||
)
|
||||
) {
|
||||
return this.collectNewMasterPasswordDetails(
|
||||
prompt,
|
||||
"Your new master password does not meet the policy requirements.\n"
|
||||
"Your new master password does not meet the policy requirements.\n",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ export class LoginCommand {
|
||||
if (masterPassword !== masterPasswordRetype) {
|
||||
return this.collectNewMasterPasswordDetails(
|
||||
prompt,
|
||||
"Master password confirmation does not match.\n"
|
||||
"Master password confirmation does not match.\n",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ export class LoginCommand {
|
||||
masterPassword,
|
||||
this.email.trim().toLowerCase(),
|
||||
kdf,
|
||||
kdfConfig
|
||||
kdfConfig,
|
||||
);
|
||||
const newPasswordHash = await this.cryptoService.hashMasterKey(masterPassword, newMasterKey);
|
||||
|
||||
@@ -586,12 +586,12 @@ export class LoginCommand {
|
||||
|
||||
private async handleCaptchaRequired(
|
||||
twoFactorRequest: TokenTwoFactorRequest,
|
||||
credentials: PasswordLoginCredentials = null
|
||||
credentials: PasswordLoginCredentials = null,
|
||||
): Promise<AuthResult | Response> {
|
||||
const badCaptcha = Response.badRequest(
|
||||
"Your authentication request has been flagged and will require user interaction to proceed.\n" +
|
||||
"Please use your API key to validate this request and ensure BW_CLIENTSECRET is correct, if set.\n" +
|
||||
"(https://bitwarden.com/help/cli-auth-challenges)"
|
||||
"(https://bitwarden.com/help/cli-auth-challenges)",
|
||||
);
|
||||
|
||||
try {
|
||||
@@ -608,7 +608,7 @@ export class LoginCommand {
|
||||
} else {
|
||||
authResultResponse = await this.authService.logInTwoFactor(
|
||||
twoFactorRequest,
|
||||
captchaClientSecret
|
||||
captchaClientSecret,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -685,7 +685,7 @@ export class LoginCommand {
|
||||
|
||||
private async openSsoPrompt(
|
||||
codeChallenge: string,
|
||||
state: string
|
||||
state: string,
|
||||
): Promise<{ ssoCode: string; orgIdentifier: string }> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const callbackServer = http.createServer((req, res) => {
|
||||
@@ -701,13 +701,13 @@ export class LoginCommand {
|
||||
"<html><head><title>Success | Bitwarden CLI</title></head><body>" +
|
||||
"<h1>Successfully authenticated with the Bitwarden CLI</h1>" +
|
||||
"<p>You may now close this tab and return to the terminal.</p>" +
|
||||
"</body></html>"
|
||||
"</body></html>",
|
||||
);
|
||||
callbackServer.close(() =>
|
||||
resolve({
|
||||
ssoCode: code,
|
||||
orgIdentifier: orgIdentifier,
|
||||
})
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
res.writeHead(400);
|
||||
@@ -715,7 +715,7 @@ export class LoginCommand {
|
||||
"<html><head><title>Failed | Bitwarden CLI</title></head><body>" +
|
||||
"<h1>Something went wrong logging into the Bitwarden CLI</h1>" +
|
||||
"<p>You may now close this tab and return to the terminal.</p>" +
|
||||
"</body></html>"
|
||||
"</body></html>",
|
||||
);
|
||||
callbackServer.close(() => reject());
|
||||
}
|
||||
@@ -735,7 +735,7 @@ export class LoginCommand {
|
||||
"&state=" +
|
||||
state +
|
||||
"&codeChallenge=" +
|
||||
codeChallenge
|
||||
codeChallenge,
|
||||
);
|
||||
});
|
||||
foundPort = true;
|
||||
|
||||
@@ -8,7 +8,7 @@ export class LogoutCommand {
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private i18nService: I18nService,
|
||||
private logoutCallback: () => Promise<void>
|
||||
private logoutCallback: () => Promise<void>,
|
||||
) {}
|
||||
|
||||
async run() {
|
||||
|
||||
@@ -27,7 +27,7 @@ export class UnlockCommand {
|
||||
private environmentService: EnvironmentService,
|
||||
private syncService: SyncService,
|
||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||
private logout: () => Promise<void>
|
||||
private logout: () => Promise<void>,
|
||||
) {}
|
||||
|
||||
async run(password: string, cmdOptions: Record<string, any>) {
|
||||
@@ -55,7 +55,7 @@ export class UnlockCommand {
|
||||
const serverKeyHash = await this.cryptoService.hashMasterKey(
|
||||
password,
|
||||
masterKey,
|
||||
HashPurpose.ServerAuthorization
|
||||
HashPurpose.ServerAuthorization,
|
||||
);
|
||||
const request = new SecretVerificationRequest();
|
||||
request.masterPasswordHash = serverKeyHash;
|
||||
@@ -65,7 +65,7 @@ export class UnlockCommand {
|
||||
const localKeyHash = await this.cryptoService.hashMasterKey(
|
||||
password,
|
||||
masterKey,
|
||||
HashPurpose.LocalAuthorization
|
||||
HashPurpose.LocalAuthorization,
|
||||
);
|
||||
await this.cryptoService.setMasterKeyHash(localKeyHash);
|
||||
} catch {
|
||||
@@ -85,7 +85,7 @@ export class UnlockCommand {
|
||||
this.environmentService,
|
||||
this.syncService,
|
||||
this.organizationApiService,
|
||||
this.logout
|
||||
this.logout,
|
||||
);
|
||||
const convertResponse = await convertToKeyConnectorCommand.run();
|
||||
if (!convertResponse.success) {
|
||||
@@ -117,7 +117,7 @@ export class UnlockCommand {
|
||||
'"\n\n' +
|
||||
"You can also pass the session key to any command with the `--session` option. ex:\n" +
|
||||
"$ bw list items --session " +
|
||||
process.env.BW_SESSION
|
||||
process.env.BW_SESSION,
|
||||
);
|
||||
res.raw = process.env.BW_SESSION;
|
||||
return Response.success(res);
|
||||
|
||||
Reference in New Issue
Block a user