mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 21:33:27 +00:00
[PM-11949] Fix generating and copying export password (#10999)
* Use password field value instead of local variable for copy to clipboard Use appCopyClick directive instead of manually copying and showing success toast * Add missing "copySuccessful" message key to desktop and web * Remove whitespace from web en/messages.json --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
07d2e36496
commit
f70b3df2d2
@@ -1285,6 +1285,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"copySuccessful": {
|
||||||
|
"message": "Copy Successful"
|
||||||
|
},
|
||||||
"errorRefreshingAccessToken": {
|
"errorRefreshingAccessToken": {
|
||||||
"message": "Access Token Refresh Error"
|
"message": "Access Token Refresh Error"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -562,6 +562,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"copySuccessful": {
|
||||||
|
"message": "Copy Successful"
|
||||||
|
},
|
||||||
"copyValue": {
|
"copyValue": {
|
||||||
"message": "Copy value",
|
"message": "Copy value",
|
||||||
"description": "Copy value to clipboard"
|
"description": "Copy value to clipboard"
|
||||||
|
|||||||
@@ -87,7 +87,9 @@
|
|||||||
[disabled]="!filePassword"
|
[disabled]="!filePassword"
|
||||||
appStopClick
|
appStopClick
|
||||||
bitSuffix
|
bitSuffix
|
||||||
(click)="copyPasswordToClipboard()"
|
[appCopyClick]="filePassword"
|
||||||
|
[valueLabel]="'password' | i18n"
|
||||||
|
showToast
|
||||||
></button>
|
></button>
|
||||||
<bit-hint>{{ "exportPasswordDescription" | i18n }}</bit-hint>
|
<bit-hint>{{ "exportPasswordDescription" | i18n }}</bit-hint>
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
encryptedExportType = EncryptedExportType;
|
encryptedExportType = EncryptedExportType;
|
||||||
protected showFilePassword: boolean;
|
protected showFilePassword: boolean;
|
||||||
|
|
||||||
filePasswordValue: string = null;
|
|
||||||
private _disabledByPolicy = false;
|
private _disabledByPolicy = false;
|
||||||
|
|
||||||
organizations$: Observable<Organization[]>;
|
organizations$: Observable<Organization[]>;
|
||||||
@@ -278,18 +277,9 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
|
|
||||||
generatePassword = async () => {
|
generatePassword = async () => {
|
||||||
const [options] = await this.passwordGenerationService.getOptions();
|
const [options] = await this.passwordGenerationService.getOptions();
|
||||||
this.filePasswordValue = await this.passwordGenerationService.generatePassword(options);
|
const generatedPassword = await this.passwordGenerationService.generatePassword(options);
|
||||||
this.exportForm.get("filePassword").setValue(this.filePasswordValue);
|
this.exportForm.get("filePassword").setValue(generatedPassword);
|
||||||
this.exportForm.get("confirmFilePassword").setValue(this.filePasswordValue);
|
this.exportForm.get("confirmFilePassword").setValue(generatedPassword);
|
||||||
};
|
|
||||||
|
|
||||||
copyPasswordToClipboard = async () => {
|
|
||||||
this.platformUtilsService.copyToClipboard(this.filePasswordValue);
|
|
||||||
this.toastService.showToast({
|
|
||||||
variant: "success",
|
|
||||||
title: null,
|
|
||||||
message: this.i18nService.t("valueCopied", this.i18nService.t("password")),
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
submit = async () => {
|
submit = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user