[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:
parent
07d2e36496
commit
f70b3df2d2
|
@ -1285,6 +1285,9 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"copySuccessful": {
|
||||
"message": "Copy Successful"
|
||||
},
|
||||
"errorRefreshingAccessToken": {
|
||||
"message": "Access Token Refresh Error"
|
||||
},
|
||||
|
|
|
@ -562,6 +562,9 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"copySuccessful": {
|
||||
"message": "Copy Successful"
|
||||
},
|
||||
"copyValue": {
|
||||
"message": "Copy value",
|
||||
"description": "Copy value to clipboard"
|
||||
|
|
|
@ -87,7 +87,9 @@
|
|||
[disabled]="!filePassword"
|
||||
appStopClick
|
||||
bitSuffix
|
||||
(click)="copyPasswordToClipboard()"
|
||||
[appCopyClick]="filePassword"
|
||||
[valueLabel]="'password' | i18n"
|
||||
showToast
|
||||
></button>
|
||||
<bit-hint>{{ "exportPasswordDescription" | i18n }}</bit-hint>
|
||||
</bit-form-field>
|
||||
|
|
|
@ -121,7 +121,6 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
encryptedExportType = EncryptedExportType;
|
||||
protected showFilePassword: boolean;
|
||||
|
||||
filePasswordValue: string = null;
|
||||
private _disabledByPolicy = false;
|
||||
|
||||
organizations$: Observable<Organization[]>;
|
||||
|
@ -278,18 +277,9 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
|
||||
generatePassword = async () => {
|
||||
const [options] = await this.passwordGenerationService.getOptions();
|
||||
this.filePasswordValue = await this.passwordGenerationService.generatePassword(options);
|
||||
this.exportForm.get("filePassword").setValue(this.filePasswordValue);
|
||||
this.exportForm.get("confirmFilePassword").setValue(this.filePasswordValue);
|
||||
};
|
||||
|
||||
copyPasswordToClipboard = async () => {
|
||||
this.platformUtilsService.copyToClipboard(this.filePasswordValue);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("valueCopied", this.i18nService.t("password")),
|
||||
});
|
||||
const generatedPassword = await this.passwordGenerationService.generatePassword(options);
|
||||
this.exportForm.get("filePassword").setValue(generatedPassword);
|
||||
this.exportForm.get("confirmFilePassword").setValue(generatedPassword);
|
||||
};
|
||||
|
||||
submit = async () => {
|
||||
|
|
Loading…
Reference in New Issue