SecuritySetting.jsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. /* eslint-disable react/no-danger */
  2. import React from 'react';
  3. import { useTranslation } from 'next-i18next';
  4. import PropTypes from 'prop-types';
  5. import { Collapse } from 'reactstrap';
  6. import AdminGeneralSecurityContainer from '~/client/services/AdminGeneralSecurityContainer';
  7. import { toastSuccess, toastError } from '~/client/util/toastr';
  8. import { PageDeleteConfigValue } from '~/interfaces/page-delete-config';
  9. import { validateDeleteConfigs, prepareDeleteConfigValuesForCalc } from '~/utils/page-delete-config';
  10. import { withUnstatedContainers } from '../../UnstatedUtils';
  11. // used as the prefix of translation
  12. const DeletionTypeForT = Object.freeze({
  13. Deletion: 'deletion',
  14. CompleteDeletion: 'complete_deletion',
  15. RecursiveDeletion: 'recursive_deletion',
  16. RecursiveCompleteDeletion: 'recursive_complete_deletion',
  17. });
  18. const DeletionType = Object.freeze({
  19. Deletion: 'deletion',
  20. CompleteDeletion: 'completeDeletion',
  21. RecursiveDeletion: 'recursiveDeletion',
  22. RecursiveCompleteDeletion: 'recursiveCompleteDeletion',
  23. });
  24. const getDeletionTypeForT = (deletionType) => {
  25. switch (deletionType) {
  26. case DeletionType.Deletion:
  27. return DeletionTypeForT.Deletion;
  28. case DeletionType.RecursiveDeletion:
  29. return DeletionTypeForT.RecursiveDeletion;
  30. case DeletionType.CompleteDeletion:
  31. return DeletionTypeForT.CompleteDeletion;
  32. case DeletionType.RecursiveCompleteDeletion:
  33. return DeletionTypeForT.RecursiveCompleteDeletion;
  34. }
  35. };
  36. const getDeleteConfigValueForT = (DeleteConfigValue) => {
  37. switch (DeleteConfigValue) {
  38. case PageDeleteConfigValue.Anyone:
  39. case null:
  40. return 'security_settings.anyone';
  41. case PageDeleteConfigValue.Inherit:
  42. return 'security_settings.inherit';
  43. case PageDeleteConfigValue.AdminOnly:
  44. return 'security_settings.admin_only';
  45. case PageDeleteConfigValue.AdminAndAuthor:
  46. return 'security_settings.admin_and_author';
  47. }
  48. };
  49. /**
  50. * Return true if "deletionType" is DeletionType.RecursiveDeletion or DeletionType.RecursiveCompleteDeletion.
  51. * @param deletionType Deletion type
  52. * @returns boolean
  53. */
  54. const isRecursiveDeletion = (deletionType) => {
  55. return deletionType === DeletionType.RecursiveDeletion || deletionType === DeletionType.RecursiveCompleteDeletion;
  56. };
  57. /**
  58. * Return true if "deletionType" is DeletionType.Deletion or DeletionType.RecursiveDeletion.
  59. * @param deletionType Deletion type
  60. * @returns boolean
  61. */
  62. const isTypeDeletion = (deletionType) => {
  63. return deletionType === DeletionType.Deletion || deletionType === DeletionType.RecursiveDeletion;
  64. };
  65. class SecuritySetting extends React.Component {
  66. constructor(props) {
  67. super(props);
  68. // functions
  69. this.putSecuritySetting = this.putSecuritySetting.bind(this);
  70. this.getRecursiveDeletionConfigState = this.getRecursiveDeletionConfigState.bind(this);
  71. this.previousPageRecursiveAuthorityState = this.previousPageRecursiveAuthorityState.bind(this);
  72. this.setPagePreviousRecursiveAuthorityState = this.setPagePreviousRecursiveAuthorityState.bind(this);
  73. this.expantDeleteOptionsState = this.expantDeleteOptionsState.bind(this);
  74. this.setExpantOtherDeleteOptionsState = this.setExpantOtherDeleteOptionsState.bind(this);
  75. this.setDeletionConfigState = this.setDeletionConfigState.bind(this);
  76. // render
  77. this.renderPageDeletePermission = this.renderPageDeletePermission.bind(this);
  78. this.renderPageDeletePermissionDropdown = this.renderPageDeletePermissionDropdown.bind(this);
  79. }
  80. async putSecuritySetting() {
  81. const { t, adminGeneralSecurityContainer } = this.props;
  82. try {
  83. await adminGeneralSecurityContainer.updateGeneralSecuritySetting();
  84. toastSuccess(t('security_settings.updated_general_security_setting'));
  85. }
  86. catch (err) {
  87. toastError(err);
  88. }
  89. }
  90. getRecursiveDeletionConfigState(deletionType) {
  91. const { adminGeneralSecurityContainer } = this.props;
  92. if (isTypeDeletion(deletionType)) {
  93. return [
  94. adminGeneralSecurityContainer.state.currentPageRecursiveDeletionAuthority,
  95. adminGeneralSecurityContainer.changePageRecursiveDeletionAuthority,
  96. ];
  97. }
  98. return [
  99. adminGeneralSecurityContainer.state.currentPageRecursiveCompleteDeletionAuthority,
  100. adminGeneralSecurityContainer.changePageRecursiveCompleteDeletionAuthority,
  101. ];
  102. }
  103. previousPageRecursiveAuthorityState(deletionType) {
  104. const { adminGeneralSecurityContainer } = this.props;
  105. return isTypeDeletion(deletionType)
  106. ? adminGeneralSecurityContainer.state.previousPageRecursiveDeletionAuthority
  107. : adminGeneralSecurityContainer.state.previousPageRecursiveCompleteDeletionAuthority;
  108. }
  109. setPagePreviousRecursiveAuthorityState(deletionType, previousState) {
  110. const { adminGeneralSecurityContainer } = this.props;
  111. if (isTypeDeletion(deletionType)) {
  112. adminGeneralSecurityContainer.changePreviousPageRecursiveDeletionAuthority(previousState);
  113. return;
  114. }
  115. adminGeneralSecurityContainer.changePreviousPageRecursiveCompleteDeletionAuthority(previousState);
  116. }
  117. expantDeleteOptionsState(deletionType) {
  118. const { adminGeneralSecurityContainer } = this.props;
  119. return isTypeDeletion(deletionType)
  120. ? adminGeneralSecurityContainer.state.expandOtherOptionsForDeletion
  121. : adminGeneralSecurityContainer.state.expandOtherOptionsForCompleteDeletion;
  122. }
  123. setExpantOtherDeleteOptionsState(deletionType, bool) {
  124. const { adminGeneralSecurityContainer } = this.props;
  125. if (isTypeDeletion(deletionType)) {
  126. adminGeneralSecurityContainer.switchExpandOtherOptionsForDeletion(bool);
  127. return;
  128. }
  129. adminGeneralSecurityContainer.switchExpandOtherOptionsForCompleteDeletion(bool);
  130. return;
  131. }
  132. /**
  133. * Force update deletion config for recursive operation when the deletion config for general operation is updated.
  134. * @param deletionType Deletion type
  135. */
  136. setDeletionConfigState(newState, setState, deletionType) {
  137. setState(newState);
  138. if (this.previousPageRecursiveAuthorityState(deletionType) !== null) {
  139. this.setPagePreviousRecursiveAuthorityState(deletionType, null);
  140. }
  141. if (isRecursiveDeletion(deletionType)) {
  142. return;
  143. }
  144. const [recursiveState, setRecursiveState] = this.getRecursiveDeletionConfigState(deletionType);
  145. const calculableValue = prepareDeleteConfigValuesForCalc(newState, recursiveState);
  146. const shouldForceUpdate = !validateDeleteConfigs(calculableValue[0], calculableValue[1]);
  147. if (shouldForceUpdate) {
  148. setRecursiveState(newState);
  149. this.setPagePreviousRecursiveAuthorityState(deletionType, recursiveState);
  150. this.setExpantOtherDeleteOptionsState(deletionType, true);
  151. }
  152. return;
  153. }
  154. renderPageDeletePermissionDropdown(currentState, setState, deletionType, isButtonDisabled) {
  155. const { t } = this.props;
  156. return (
  157. <div className="dropdown">
  158. <button
  159. className="btn btn-outline-secondary dropdown-toggle text-end"
  160. type="button"
  161. id="dropdownMenuButton"
  162. data-bs-toggle="dropdown"
  163. aria-haspopup="true"
  164. aria-expanded="true"
  165. >
  166. <span className="float-start">
  167. {t(getDeleteConfigValueForT(currentState))}
  168. </span>
  169. </button>
  170. <div className="dropdown-menu" aria-labelledby="dropdownMenuButton">
  171. {
  172. isRecursiveDeletion(deletionType)
  173. ? (
  174. <button
  175. className="dropdown-item"
  176. type="button"
  177. onClick={() => { this.setDeletionConfigState(PageDeleteConfigValue.Inherit, setState, deletionType) }}
  178. >
  179. {t('security_settings.inherit')}
  180. </button>
  181. )
  182. : (
  183. <button
  184. className="dropdown-item"
  185. type="button"
  186. onClick={() => { this.setDeletionConfigState(PageDeleteConfigValue.Anyone, setState, deletionType) }}
  187. >
  188. {t('security_settings.anyone')}
  189. </button>
  190. )
  191. }
  192. <button
  193. className={`dropdown-item ${isButtonDisabled ? 'disabled' : ''}`}
  194. type="button"
  195. onClick={() => { this.setDeletionConfigState(PageDeleteConfigValue.AdminAndAuthor, setState, deletionType) }}
  196. >
  197. {t('security_settings.admin_and_author')}
  198. </button>
  199. <button
  200. className="dropdown-item"
  201. type="button"
  202. onClick={() => { this.setDeletionConfigState(PageDeleteConfigValue.AdminOnly, setState, deletionType) }}
  203. >
  204. {t('security_settings.admin_only')}
  205. </button>
  206. </div>
  207. <p className="form-text text-muted small">
  208. {t(`security_settings.${getDeletionTypeForT(deletionType)}_explanation`)}
  209. </p>
  210. </div>
  211. );
  212. }
  213. renderPageDeletePermission(currentState, setState, deletionType, isButtonDisabled) {
  214. const { t, adminGeneralSecurityContainer } = this.props;
  215. const expantDeleteOptionsState = this.expantDeleteOptionsState(deletionType);
  216. return (
  217. <div key={`page-delete-permission-dropdown-${deletionType}`} className="row">
  218. <div className="col-md-3 text-md-end">
  219. {!isRecursiveDeletion(deletionType) && isTypeDeletion(deletionType) && (
  220. <strong>{t('security_settings.page_delete')}</strong>
  221. )}
  222. {!isRecursiveDeletion(deletionType) && !isTypeDeletion(deletionType) && (
  223. <strong>{t('security_settings.page_delete_completely')}</strong>
  224. )}
  225. </div>
  226. <div className="col-md-6">
  227. {
  228. !isRecursiveDeletion(deletionType)
  229. ? (
  230. <>
  231. {this.renderPageDeletePermissionDropdown(currentState, setState, deletionType, isButtonDisabled)}
  232. {currentState === PageDeleteConfigValue.Anyone && deletionType === DeletionType.CompleteDeletion && (
  233. <>
  234. <input
  235. id="isAllGroupMembershipRequiredForPageCompleteDeletionCheckbox"
  236. className="form-check-input"
  237. type="checkbox"
  238. checked={adminGeneralSecurityContainer.state.isAllGroupMembershipRequiredForPageCompleteDeletion}
  239. onChange={() => { adminGeneralSecurityContainer.switchIsAllGroupMembershipRequiredForPageCompleteDeletion() }}
  240. />
  241. <label className="form-check-label" htmlFor="isAllGroupMembershipRequiredForPageCompleteDeletionCheckbox">
  242. {t('security_settings.is_all_group_membership_required_for_page_complete_deletion')}
  243. </label>
  244. <p
  245. className="form-text text-muted small mt-2"
  246. >
  247. {t('security_settings.is_all_group_membership_required_for_page_complete_deletion_explanation')}
  248. </p>
  249. </>
  250. )}
  251. </>
  252. )
  253. : (
  254. <>
  255. <button
  256. type="button"
  257. className="btn btn-link p-0 mb-4"
  258. aria-expanded="false"
  259. onClick={() => this.setExpantOtherDeleteOptionsState(deletionType, !expantDeleteOptionsState)}
  260. >
  261. <span className={`material-symbols-outlined me-1 ${expantDeleteOptionsState ? 'fa-rotate-90' : ''}`}>navigate_next</span>
  262. { t('security_settings.other_options') }
  263. </button>
  264. <Collapse isOpen={expantDeleteOptionsState}>
  265. <div className="pb-4">
  266. <p className="card custom-card">
  267. <span className="text-warning">
  268. <span className="material-symbols-outlined">info</span>
  269. {/* eslint-disable-next-line react/no-danger */}
  270. <span dangerouslySetInnerHTML={{ __html: t('security_settings.page_delete_rights_caution') }} />
  271. </span>
  272. </p>
  273. { this.previousPageRecursiveAuthorityState(deletionType) !== null && (
  274. <div className="mb-3">
  275. <strong>
  276. {t('security_settings.forced_update_desc')}
  277. </strong>
  278. <code>
  279. {t(getDeleteConfigValueForT(this.previousPageRecursiveAuthorityState(deletionType)))}
  280. </code>
  281. </div>
  282. )}
  283. {this.renderPageDeletePermissionDropdown(currentState, setState, deletionType, isButtonDisabled)}
  284. </div>
  285. </Collapse>
  286. </>
  287. )
  288. }
  289. </div>
  290. </div>
  291. );
  292. }
  293. render() {
  294. const { t, adminGeneralSecurityContainer } = this.props;
  295. const {
  296. currentRestrictGuestMode, currentPageDeletionAuthority, currentPageCompleteDeletionAuthority,
  297. currentPageRecursiveDeletionAuthority, currentPageRecursiveCompleteDeletionAuthority,
  298. } = adminGeneralSecurityContainer.state;
  299. const isButtonDisabledForDeletion = !validateDeleteConfigs(
  300. adminGeneralSecurityContainer.state.currentPageDeletionAuthority, PageDeleteConfigValue.AdminAndAuthor,
  301. );
  302. const isButtonDisabledForCompleteDeletion = !validateDeleteConfigs(
  303. adminGeneralSecurityContainer.state.currentPageCompleteDeletionAuthority, PageDeleteConfigValue.AdminAndAuthor,
  304. );
  305. return (
  306. <React.Fragment>
  307. <h2 className="alert-anchor border-bottom">
  308. {t('security_settings.security_settings')}
  309. </h2>
  310. {adminGeneralSecurityContainer.retrieveError != null && (
  311. <div className="alert alert-danger">
  312. <p>{t('Error occurred')} : {adminGeneralSecurityContainer.retrieveError}</p>
  313. </div>
  314. )}
  315. <h4 className="mt-4">{ t('security_settings.page_list_and_search_results') }</h4>
  316. <div className="row justify-content-md-center">
  317. <table className="table table-bordered col-lg-9 mb-5">
  318. <thead>
  319. <tr>
  320. <th scope="col">{ t('security_settings.scope_of_page_disclosure') }</th>
  321. <th scope="col">{ t('security_settings.set_point') }</th>
  322. </tr>
  323. </thead>
  324. <tbody>
  325. <tr>
  326. <th scope="row">{ t('public') }</th>
  327. <td><span className="material-symbols-outlined text-success me-1">check_circle</span>{ t('security_settings.always_displayed') }</td>
  328. </tr>
  329. <tr>
  330. <th scope="row">{ t('anyone_with_the_link') }</th>
  331. <td><span className="material-symbols-outlined text-danger me-1">cancel</span>{ t('security_settings.always_hidden') }</td>
  332. </tr>
  333. <tr>
  334. <th scope="row">{ t('only_me') }</th>
  335. <td>
  336. <div className="form-check form-switch form-check-success">
  337. <input
  338. type="checkbox"
  339. className="form-check-input"
  340. id="isShowRestrictedByOwner"
  341. checked={!adminGeneralSecurityContainer.state.isShowRestrictedByOwner}
  342. onChange={() => { adminGeneralSecurityContainer.switchIsShowRestrictedByOwner() }}
  343. />
  344. <label className="form-label form-check-label" htmlFor="isShowRestrictedByOwner">
  345. {t('security_settings.displayed_or_hidden')}
  346. </label>
  347. </div>
  348. </td>
  349. </tr>
  350. <tr>
  351. <th scope="row">{ t('only_inside_the_group') }</th>
  352. <td>
  353. <div className="form-check form-switch form-check-success">
  354. <input
  355. type="checkbox"
  356. className="form-check-input"
  357. id="isShowRestrictedByGroup"
  358. checked={!adminGeneralSecurityContainer.state.isShowRestrictedByGroup}
  359. onChange={() => { adminGeneralSecurityContainer.switchIsShowRestrictedByGroup() }}
  360. />
  361. <label className="form-label form-check-label" htmlFor="isShowRestrictedByGroup">
  362. {t('security_settings.displayed_or_hidden')}
  363. </label>
  364. </div>
  365. </td>
  366. </tr>
  367. </tbody>
  368. </table>
  369. </div>
  370. <h4>{t('security_settings.page_access_rights')}</h4>
  371. <div className="row mb-4">
  372. <div className="col-md-3 text-md-end py-2">
  373. <strong>{t('security_settings.Guest Users Access')}</strong>
  374. </div>
  375. <div className="col-md-9">
  376. <div className="dropdown">
  377. <button
  378. className={`btn btn-outline-secondary dropdown-toggle text-end col-12
  379. col-md-auto ${adminGeneralSecurityContainer.isWikiModeForced && 'disabled'}`}
  380. type="button"
  381. id="dropdownMenuButton"
  382. data-bs-toggle="dropdown"
  383. aria-haspopup="true"
  384. aria-expanded="true"
  385. >
  386. <span className="float-start">
  387. {currentRestrictGuestMode === 'Deny' && t('security_settings.guest_mode.deny')}
  388. {currentRestrictGuestMode === 'Readonly' && t('security_settings.guest_mode.readonly')}
  389. </span>
  390. </button>
  391. <div className="dropdown-menu" aria-labelledby="dropdownMenuButton">
  392. <button className="dropdown-item" type="button" onClick={() => { adminGeneralSecurityContainer.changeRestrictGuestMode('Deny') }}>
  393. {t('security_settings.guest_mode.deny')}
  394. </button>
  395. <button className="dropdown-item" type="button" onClick={() => { adminGeneralSecurityContainer.changeRestrictGuestMode('Readonly') }}>
  396. {t('security_settings.guest_mode.readonly')}
  397. </button>
  398. </div>
  399. </div>
  400. {adminGeneralSecurityContainer.isWikiModeForced && (
  401. <p className="alert alert-warning mt-2 col-6">
  402. <span className="material-symbols-outlined me-1">error</span>
  403. <b>FIXED</b><br />
  404. <b
  405. dangerouslySetInnerHTML={{
  406. __html: t('security_settings.Fixed by env var',
  407. { key: 'FORCE_WIKI_MODE', value: adminGeneralSecurityContainer.state.wikiMode }),
  408. }}
  409. />
  410. </p>
  411. )}
  412. </div>
  413. </div>
  414. <h4>{t('security_settings.page_delete_rights')}</h4>
  415. {/* Render PageDeletePermission */}
  416. {
  417. [
  418. [currentPageDeletionAuthority, adminGeneralSecurityContainer.changePageDeletionAuthority, DeletionType.Deletion, false],
  419. // eslint-disable-next-line max-len
  420. [currentPageRecursiveDeletionAuthority, adminGeneralSecurityContainer.changePageRecursiveDeletionAuthority, DeletionType.RecursiveDeletion, isButtonDisabledForDeletion],
  421. ].map(arr => this.renderPageDeletePermission(arr[0], arr[1], arr[2], arr[3]))
  422. }
  423. {
  424. [
  425. [currentPageCompleteDeletionAuthority, adminGeneralSecurityContainer.changePageCompleteDeletionAuthority, DeletionType.CompleteDeletion, false],
  426. // eslint-disable-next-line max-len
  427. [currentPageRecursiveCompleteDeletionAuthority, adminGeneralSecurityContainer.changePageRecursiveCompleteDeletionAuthority, DeletionType.RecursiveCompleteDeletion, isButtonDisabledForCompleteDeletion],
  428. ].map(arr => this.renderPageDeletePermission(arr[0], arr[1], arr[2], arr[3]))
  429. }
  430. <h4>{t('security_settings.user_homepage_deletion.user_homepage_deletion')}</h4>
  431. <div className="row mb-4">
  432. <div className="col-6 offset-3">
  433. <div className="form-check form-switch form-check-success">
  434. <input
  435. type="checkbox"
  436. className="form-check-input"
  437. id="is-user-page-deletion-enabled"
  438. checked={adminGeneralSecurityContainer.state.isUsersHomepageDeletionEnabled}
  439. onChange={() => { adminGeneralSecurityContainer.switchIsUsersHomepageDeletionEnabled() }}
  440. />
  441. <label className="form-label form-check-label" htmlFor="is-user-page-deletion-enabled">
  442. {t('security_settings.user_homepage_deletion.enable_user_homepage_deletion')}
  443. </label>
  444. </div>
  445. <div className="custom-control custom-switch custom-checkbox-success mt-2">
  446. <input
  447. type="checkbox"
  448. className="form-check-input"
  449. id="is-force-delete-user-homepage-on-user-deletion"
  450. checked={adminGeneralSecurityContainer.state.isForceDeleteUserHomepageOnUserDeletion}
  451. onChange={() => { adminGeneralSecurityContainer.switchIsForceDeleteUserHomepageOnUserDeletion() }}
  452. disabled={!adminGeneralSecurityContainer.state.isUsersHomepageDeletionEnabled}
  453. />
  454. <label className="form-check-label" htmlFor="is-force-delete-user-homepage-on-user-deletion">
  455. {t('security_settings.user_homepage_deletion.enable_force_delete_user_homepage_on_user_deletion')}
  456. </label>
  457. </div>
  458. <p
  459. className="form-text text-muted small mt-2"
  460. dangerouslySetInnerHTML={{ __html: t('security_settings.user_homepage_deletion.desc') }}
  461. />
  462. </div>
  463. </div>
  464. <h4>{t('security_settings.session')}</h4>
  465. <div className="row">
  466. <label className="text-start text-md-end col-md-3 col-form-label">{t('security_settings.max_age')}</label>
  467. <div className="col-md-6">
  468. <input
  469. className="form-control col-md-3"
  470. type="text"
  471. defaultValue={adminGeneralSecurityContainer.state.sessionMaxAge || ''}
  472. onChange={(e) => {
  473. adminGeneralSecurityContainer.setSessionMaxAge(e.target.value);
  474. }}
  475. placeholder="2592000000"
  476. />
  477. {/* eslint-disable-next-line react/no-danger */}
  478. <p className="form-text text-muted" dangerouslySetInnerHTML={{ __html: t('security_settings.max_age_desc') }} />
  479. <p className="card custom-card">
  480. <span className="text-warning">
  481. <span className="material-symbols-outlined">info</span> {t('security_settings.max_age_caution')}
  482. </span>
  483. </p>
  484. </div>
  485. </div>
  486. <div className="row my-3">
  487. <div className="text-center text-md-start offset-md-3 col-md-5">
  488. <button type="button" className="btn btn-primary" disabled={adminGeneralSecurityContainer.retrieveError != null} onClick={this.putSecuritySetting}>
  489. {t('Update')}
  490. </button>
  491. </div>
  492. </div>
  493. </React.Fragment>
  494. );
  495. }
  496. }
  497. SecuritySetting.propTypes = {
  498. t: PropTypes.func.isRequired, // i18next
  499. adminGeneralSecurityContainer: PropTypes.instanceOf(AdminGeneralSecurityContainer).isRequired,
  500. };
  501. const SecuritySettingWrapperFC = (props) => {
  502. const { t } = useTranslation('admin');
  503. return <SecuritySetting t={t} {...props} />;
  504. };
  505. const SecuritySettingWrapper = withUnstatedContainers(SecuritySettingWrapperFC, [AdminGeneralSecurityContainer]);
  506. export default SecuritySettingWrapper;