mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-19 20:51:35 +01:00
[PM-3878] Setting send password to null if it is empty (#6276)
* setting send password to null if it is empty * Using Utils.IsNullOrWhiteSpace to verify name and password on SendAddEdit. Removed unnecessary setting password as null on desktop
This commit is contained in:
parent
931a2258e2
commit
c9245df8d3
@ -50,7 +50,6 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async refresh() {
|
async refresh() {
|
||||||
this.password = null;
|
|
||||||
const send = await this.loadSend();
|
const send = await this.loadSend();
|
||||||
this.send = await send.decrypt();
|
this.send = await send.decrypt();
|
||||||
this.updateFormValues();
|
this.updateFormValues();
|
||||||
|
@ -11,6 +11,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
|||||||
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.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 { EncArrayBuffer } from "@bitwarden/common/platform/models/domain/enc-array-buffer";
|
||||||
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
||||||
import { Send } from "@bitwarden/common/tools/send/models/domain/send";
|
import { Send } from "@bitwarden/common/tools/send/models/domain/send";
|
||||||
@ -67,7 +68,6 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
disableHideEmail = false;
|
disableHideEmail = false;
|
||||||
send: SendView;
|
send: SendView;
|
||||||
hasPassword: boolean;
|
hasPassword: boolean;
|
||||||
password: string;
|
|
||||||
showPassword = false;
|
showPassword = false;
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
deletePromise: Promise<any>;
|
deletePromise: Promise<any>;
|
||||||
@ -252,7 +252,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
this.send.disabled = this.formGroup.controls.disabled.value;
|
this.send.disabled = this.formGroup.controls.disabled.value;
|
||||||
this.send.type = this.type;
|
this.send.type = this.type;
|
||||||
|
|
||||||
if (this.send.name == null || this.send.name === "") {
|
if (Utils.isNullOrWhitespace(this.send.name)) {
|
||||||
this.platformUtilsService.showToast(
|
this.platformUtilsService.showToast(
|
||||||
"error",
|
"error",
|
||||||
this.i18nService.t("errorOccurred"),
|
this.i18nService.t("errorOccurred"),
|
||||||
@ -286,11 +286,8 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (Utils.isNullOrWhitespace(this.send.password)) {
|
||||||
this.formGroup.controls.password.value != null &&
|
this.send.password = null;
|
||||||
this.formGroup.controls.password.value.trim() === ""
|
|
||||||
) {
|
|
||||||
this.password = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.formPromise = this.encryptSend(file).then(async (encSend) => {
|
this.formPromise = this.encryptSend(file).then(async (encSend) => {
|
||||||
@ -379,12 +376,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async encryptSend(file: File): Promise<[Send, EncArrayBuffer]> {
|
protected async encryptSend(file: File): Promise<[Send, EncArrayBuffer]> {
|
||||||
const sendData = await this.sendService.encrypt(
|
const sendData = await this.sendService.encrypt(this.send, file, this.send.password, null);
|
||||||
this.send,
|
|
||||||
file,
|
|
||||||
this.formGroup.controls.password.value,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
// Parse dates
|
// Parse dates
|
||||||
try {
|
try {
|
||||||
@ -420,7 +412,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
hideEmail: this.send?.hideEmail ?? false,
|
hideEmail: this.send?.hideEmail ?? false,
|
||||||
disabled: this.send?.disabled ?? false,
|
disabled: this.send?.disabled ?? false,
|
||||||
type: this.send.type ?? this.type,
|
type: this.send.type ?? this.type,
|
||||||
password: "",
|
password: null,
|
||||||
|
|
||||||
selectedDeletionDatePreset: this.editMode ? DatePreset.Custom : DatePreset.SevenDays,
|
selectedDeletionDatePreset: this.editMode ? DatePreset.Custom : DatePreset.SevenDays,
|
||||||
selectedExpirationDatePreset: this.editMode ? DatePreset.Custom : DatePreset.Never,
|
selectedExpirationDatePreset: this.editMode ? DatePreset.Custom : DatePreset.Never,
|
||||||
|
Loading…
Reference in New Issue
Block a user