Skip to content

Commit

Permalink
PB-34290 WP3.4 - Edit standalone TOTP resource in v5 format
Browse files Browse the repository at this point in the history
  • Loading branch information
Benj1er authored and cedricalfonsi committed Aug 9, 2024
1 parent 8a50e22 commit 4b3db91
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class EditStandaloneTotp extends Component {
*/
get defaultState() {
const resource = this.props.resource || {};
const name = resource.name || "";
const uri = resource.uri || "";
const name = resource.metadata.name || "";
const uri = resource.metadata.uris?.[0] || "";

return {
nameOriginal: name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ export class HandleTotpWorkflow extends React.Component {
resourceDto.resource_type_id = this.props.context.resourceTypesSettings.findResourceTypeIdBySlug(
this.props.context.resourceTypesSettings.DEFAULT_RESOURCE_TYPES_SLUGS.TOTP
);
// @TODO E2EE resource_type_id duplicate for resource
resourceDto.metadata.resource_type_id = resourceDto.resource_type_id;

return this.props.context.port.request("passbolt.resources.update", resourceDto, secretDto);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ describe("HandleReviewAccountRecoveryRequestWorkflow", () => {
resource_type_id: props.context.resourceTypesSettings.findResourceTypeIdBySlug("totp"),
...totp.toResourceDto()
};
resourceDto.metadata.resource_type_id = props.context.resourceTypesSettings.findResourceTypeIdBySlug("totp");

expect(props.context.port.request).toHaveBeenCalledWith("passbolt.resources.update", resourceDto, totp.toSecretDto());
expect(props.actionFeedbackContext.displaySuccess).toHaveBeenCalledWith("The TOTP has been updated successfully");
Expand All @@ -230,6 +231,7 @@ describe("HandleReviewAccountRecoveryRequestWorkflow", () => {
resource_type_id: props.context.resourceTypesSettings.findResourceTypeIdBySlug("totp"),
...totp.toResourceDto()
};
resourceDto.metadata.resource_type_id = props.context.resourceTypesSettings.findResourceTypeIdBySlug("totp");

expect(props.context.port.request).toHaveBeenCalledWith("passbolt.resources.update", resourceDto, totp.toSecretDto());
expect(props.dialogContext.open).toHaveBeenCalledWith(NotifyError, {error});
Expand Down

0 comments on commit 4b3db91

Please sign in to comment.