1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-06 11:43:51 +00:00

Merge branch 'master' into EC-598-beeep-properly-store-passkeys-in-bitwarden

This commit is contained in:
Andreas Coroiu
2023-09-18 11:07:12 +02:00
205 changed files with 1358 additions and 1515 deletions

View File

@@ -17,7 +17,6 @@ export const LOGOUT_CALLBACK = new InjectionToken<
export const LOCKED_CALLBACK = new InjectionToken<(userId?: string) => Promise<void>>(
"LOCKED_CALLBACK"
);
export const CLIENT_TYPE = new InjectionToken<boolean>("CLIENT_TYPE");
export const LOCALES_DIRECTORY = new InjectionToken<string>("LOCALES_DIRECTORY");
export const SYSTEM_LANGUAGE = new InjectionToken<string>("SYSTEM_LANGUAGE");
export const LOG_MAC_FAILURES = new InjectionToken<string>("LOG_MAC_FAILURES");

View File

@@ -647,6 +647,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
ConfigApiServiceAbstraction,
AuthServiceAbstraction,
EnvironmentServiceAbstraction,
LogService,
],
},
{

View File

@@ -11,6 +11,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { EncArrayBuffer } from "@bitwarden/common/platform/models/domain/enc-array-buffer";
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import { Send } from "@bitwarden/common/tools/send/models/domain/send";
@@ -67,7 +68,6 @@ export class AddEditComponent implements OnInit, OnDestroy {
disableHideEmail = false;
send: SendView;
hasPassword: boolean;
password: string;
showPassword = false;
formPromise: Promise<any>;
deletePromise: Promise<any>;
@@ -207,9 +207,6 @@ export class AddEditComponent implements OnInit, OnDestroy {
this.send = await send.decrypt();
this.type = this.send.type;
this.updateFormValues();
if (this.send.hideEmail) {
this.formGroup.controls.hideEmail.enable();
}
} else {
this.send = new SendView();
this.send.type = this.type;
@@ -252,7 +249,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
this.send.disabled = this.formGroup.controls.disabled.value;
this.send.type = this.type;
if (this.send.name == null || this.send.name === "") {
if (Utils.isNullOrWhitespace(this.send.name)) {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
@@ -286,11 +283,8 @@ export class AddEditComponent implements OnInit, OnDestroy {
}
}
if (
this.formGroup.controls.password.value != null &&
this.formGroup.controls.password.value.trim() === ""
) {
this.password = null;
if (Utils.isNullOrWhitespace(this.send.password)) {
this.send.password = null;
}
this.formPromise = this.encryptSend(file).then(async (encSend) => {
@@ -379,12 +373,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
}
protected async encryptSend(file: File): Promise<[Send, EncArrayBuffer]> {
const sendData = await this.sendService.encrypt(
this.send,
file,
this.formGroup.controls.password.value,
null
);
const sendData = await this.sendService.encrypt(this.send, file, this.send.password, null);
// Parse dates
try {
@@ -420,7 +409,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
hideEmail: this.send?.hideEmail ?? false,
disabled: this.send?.disabled ?? false,
type: this.send.type ?? this.type,
password: "",
password: null,
selectedDeletionDatePreset: this.editMode ? DatePreset.Custom : DatePreset.SevenDays,
selectedExpirationDatePreset: this.editMode ? DatePreset.Custom : DatePreset.Never,
@@ -433,6 +422,10 @@ export class AddEditComponent implements OnInit, OnDestroy {
"yyyy-MM-ddTHH:mm"
),
});
if (this.send.hideEmail) {
this.formGroup.controls.hideEmail.enable();
}
}
private async handleCopyLinkToClipboard() {

View File

@@ -27,7 +27,8 @@ export class PasswordRepromptComponent {
}
async submit() {
if (!(await this.cryptoService.compareAndUpdateKeyHash(this.masterPassword, null))) {
const storedMasterKey = await this.cryptoService.getOrDeriveMasterKey(this.masterPassword);
if (!(await this.cryptoService.compareAndUpdateKeyHash(this.masterPassword, storedMasterKey))) {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),