-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: logout modal Autologout: logout to currentPage and display Modal to reconnect * build: bumb version to 2.4.17-rc1 * build: bumb version to 2.4.17
- Loading branch information
1 parent
d023992
commit af9ff72
Showing
9 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
import { LogoutModal } from 'components/modals/logout'; | ||
import { useOidc } from 'utils/oidc'; | ||
|
||
const secure = (WrappedComponent) => { | ||
export const secure = (WrappedComponent) => { | ||
const Component = (props) => { | ||
const oidc = useOidc(); | ||
const { isUserLoggedIn, login } = oidc; | ||
const { isUserLoggedIn } = oidc; | ||
const { otherProps } = props; | ||
|
||
if (isUserLoggedIn) { | ||
return <WrappedComponent {...otherProps} />; | ||
} | ||
login({ | ||
doesCurrentHrefRequiresAuth: true, | ||
}); | ||
return null; | ||
} else return <LogoutModal />; | ||
}; | ||
|
||
return Component; | ||
}; | ||
|
||
export default secure; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default } from './hoc'; | ||
export { secure } from './hoc'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as LogoutModal } from './logout'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Dialog from '@material-ui/core/Dialog'; | ||
import DialogActions from '@material-ui/core/DialogActions'; | ||
import DialogContent from '@material-ui/core/DialogContent'; | ||
import DialogContentText from '@material-ui/core/DialogContentText'; | ||
import DialogTitle from '@material-ui/core/DialogTitle'; | ||
import { buttonDictionary, errorDictionary } from 'i18n'; | ||
import { useOidc } from 'utils/oidc'; | ||
import { Button } from '../../designSystem'; | ||
|
||
const LogoutModal = () => { | ||
const { isUserLoggedIn, login: oidcLogin } = useOidc(); | ||
|
||
const login = () => oidcLogin({ doesCurrentHrefRequiresAuth: true }); | ||
|
||
return ( | ||
<Dialog | ||
open={!isUserLoggedIn} | ||
disableEscapeKeyDown | ||
aria-labelledby='alert-dialog-slide-title' | ||
aria-describedby='alert-dialog-slide-description' | ||
> | ||
<DialogTitle id='alert-dialog-slide-title'> | ||
{errorDictionary.getErrorLogOffTitle} | ||
</DialogTitle> | ||
<DialogContent id='alert-dialog-slide-description'> | ||
<DialogContentText> | ||
{errorDictionary.getErrorLogOffDetails1} | ||
</DialogContentText> | ||
<DialogContentText> | ||
{errorDictionary.getErrorLogOffDetails2} | ||
</DialogContentText> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button onClick={login}>{buttonDictionary.reconnect}</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default LogoutModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters