mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
[PM-14965] Fix password reprompt for context menu actions (#12213)
* [PM-14965] Add return value for copy-cipher-field.service * [PM-14965] Cleanup loadAction handling in updated browser view item page * [PM-14965] Fix unit tests * [PM-14965] Clear copy mock
This commit is contained in:
@@ -95,13 +95,15 @@ export class CopyCipherFieldService {
|
||||
* @param actionType The type of field being copied.
|
||||
* @param cipher The cipher containing the field to copy.
|
||||
* @param skipReprompt Whether to skip password re-prompting.
|
||||
*
|
||||
* @returns Whether the field was copied successfully.
|
||||
*/
|
||||
async copy(
|
||||
valueToCopy: string,
|
||||
actionType: CopyAction,
|
||||
cipher: CipherView,
|
||||
skipReprompt: boolean = false,
|
||||
) {
|
||||
): Promise<boolean> {
|
||||
const action = CopyActions[actionType];
|
||||
if (
|
||||
!skipReprompt &&
|
||||
@@ -109,16 +111,16 @@ export class CopyCipherFieldService {
|
||||
action.protected &&
|
||||
!(await this.passwordRepromptService.showPasswordPrompt())
|
||||
) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (valueToCopy == null) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (actionType === "totp") {
|
||||
if (!(await this.totpAllowed(cipher))) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
valueToCopy = await this.totpService.getCode(valueToCopy);
|
||||
}
|
||||
@@ -138,6 +140,8 @@ export class CopyCipherFieldService {
|
||||
cipher.organizationId,
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user