Skip to content

Commit

Permalink
Merge branch '5' into 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 24, 2025
2 parents 8ed8519 + 82db5b2 commit bb01dd9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions en/02_Developer_Guides/09_Security/04_Sudo_Mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ specific react component.
> [!WARNING]
> Sudo mode for react components does not protect the data the component manages, or any endpoints the component uses, it simply requires the user to re-enter their password before the component is rendered.

> [!IMPORTANT]
> The `WithSudoMode` HOC is exposed via [Webpack's expose-loader plugin](https://webpack.js.org/loaders/expose-loader/). You will need to add it as a [webpack external](https://webpack.js.org/configuration/externals/) to use it. The recommended way to do this is via the [@silverstripe/webpack-config npm package](https://www.npmjs.com/package/@silverstripe/webpack-config) which handles all the external configuration for you.

You can get the injector to apply the HOC to your component automatically using [injector transformations](/developer_guides/customising_the_admin_interface/reactjs_and_redux/#transforming-services-using-middleware):
You can get the injector to apply the HOC to your component automatically using [injector transformations](/developer_guides/customising_the_admin_interface/reactjs_redux_and_graphql/#transforming-services-using-middleware):

```js
import WithSudoMode from 'containers/SudoMode/SudoMode';
Expand All @@ -107,6 +104,9 @@ Injector.transform('MyComponentWithSudoMode', (updater) => {
});
```

> [!IMPORTANT]
> The `WithSudoMode` HOC is exposed via [Webpack's expose-loader plugin](https://webpack.js.org/loaders/expose-loader/). You will need to add it as a [webpack external](https://webpack.js.org/configuration/externals/) to use it. The recommended way to do this is via the [@silverstripe/webpack-config npm package](https://www.npmjs.com/package/@silverstripe/webpack-config) which handles all the external configuration for you.

If the user has already activated sudo mode and it has not expired, they can interact with your component automatically. Otherwise, they will need to verify their identity by re-entering their password.

![Sudo mode HOC example](../../_images/sudomode.png)
Expand Down

0 comments on commit bb01dd9

Please sign in to comment.