|
@@ -2,6 +2,9 @@
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
import { withTranslation } from 'react-i18next';
|
|
import { withTranslation } from 'react-i18next';
|
|
|
|
|
+import {
|
|
|
|
|
+ Dropdown, DropdownToggle, DropdownMenu, DropdownItem,
|
|
|
|
|
+} from 'reactstrap';
|
|
|
|
|
|
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
import { toastSuccess, toastError } from '../../../util/apiNotification';
|
|
import { toastSuccess, toastError } from '../../../util/apiNotification';
|
|
@@ -75,24 +78,22 @@ class LocalSecuritySetting extends React.Component {
|
|
|
)}
|
|
)}
|
|
|
|
|
|
|
|
<div className="row mb-5">
|
|
<div className="row mb-5">
|
|
|
- <div className="col-xs-3 my-3 text-right">
|
|
|
|
|
- <strong>{t('security_setting.Local.name')}</strong>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className="col-xs-6 text-left">
|
|
|
|
|
- <div className="checkbox checkbox-success">
|
|
|
|
|
|
|
+ <div className="col-6 offset-3">
|
|
|
|
|
+ <div className="custom-control custom-switch checkbox-success">
|
|
|
<input
|
|
<input
|
|
|
- id="isLocalEnabled"
|
|
|
|
|
type="checkbox"
|
|
type="checkbox"
|
|
|
- checked={adminGeneralSecurityContainer.state.isLocalEnabled}
|
|
|
|
|
- onChange={() => { adminGeneralSecurityContainer.switchIsLocalEnabled() }}
|
|
|
|
|
|
|
+ className="custom-control-input"
|
|
|
|
|
+ id="isLocalEnabled"
|
|
|
|
|
+ checked={isLocalEnabled}
|
|
|
|
|
+ onChange={() => adminGeneralSecurityContainer.switchIsLocalEnabled()}
|
|
|
disabled={adminLocalSecurityContainer.state.useOnlyEnvVars}
|
|
disabled={adminLocalSecurityContainer.state.useOnlyEnvVars}
|
|
|
/>
|
|
/>
|
|
|
- <label htmlFor="isLocalEnabled">
|
|
|
|
|
|
|
+ <label className="custom-control-label" htmlFor="isLocalEnabled">
|
|
|
{t('security_setting.Local.enable_local')}
|
|
{t('security_setting.Local.enable_local')}
|
|
|
</label>
|
|
</label>
|
|
|
</div>
|
|
</div>
|
|
|
{(!adminGeneralSecurityContainer.state.setupStrategies.includes('local') && isLocalEnabled)
|
|
{(!adminGeneralSecurityContainer.state.setupStrategies.includes('local') && isLocalEnabled)
|
|
|
- && <div className="label label-warning">{t('security_setting.setup_is_not_yet_complete')}</div>}
|
|
|
|
|
|
|
+ && <div className="label label-warning">{t('security_setting.setup_is_not_yet_complete')}</div>}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -101,74 +102,63 @@ class LocalSecuritySetting extends React.Component {
|
|
|
|
|
|
|
|
<h3 className="border-bottom">{t('security_setting.configuration')}</h3>
|
|
<h3 className="border-bottom">{t('security_setting.configuration')}</h3>
|
|
|
|
|
|
|
|
- <div className="row mb-5">
|
|
|
|
|
- <strong className="col-xs-3 text-right">{t('Register limitation')}</strong>
|
|
|
|
|
- <div className="col-xs-9 text-left">
|
|
|
|
|
- <div className="my-0 btn-group">
|
|
|
|
|
- <div className="dropdown">
|
|
|
|
|
- <button className="btn btn-default dropdown-toggle w-100" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
|
|
|
- {registrationMode === 'Open' && <span className="pull-left">{t('security_setting.registration_mode.open')}</span>}
|
|
|
|
|
- {registrationMode === 'Restricted' && <span className="pull-left">{t('security_setting.registration_mode.restricted')}</span>}
|
|
|
|
|
- {registrationMode === 'Closed' && <span className="pull-left">{t('security_setting.registration_mode.closed')}</span>}
|
|
|
|
|
- <span className="bs-caret pull-right">
|
|
|
|
|
- <span className="caret" />
|
|
|
|
|
- </span>
|
|
|
|
|
- </button>
|
|
|
|
|
- {/* TODO adjust dropdown after BS4 */}
|
|
|
|
|
- <ul className="dropdown-menu" role="menu">
|
|
|
|
|
- <li
|
|
|
|
|
- key="Open"
|
|
|
|
|
- role="presentation"
|
|
|
|
|
- type="button"
|
|
|
|
|
- onClick={() => { adminLocalSecurityContainer.changeRegistrationMode('Open') }}
|
|
|
|
|
- >
|
|
|
|
|
- <a role="menuitem">{t('security_setting.registration_mode.open')}</a>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li
|
|
|
|
|
- key="Restricted"
|
|
|
|
|
- role="presentation"
|
|
|
|
|
- type="button"
|
|
|
|
|
- onClick={() => { adminLocalSecurityContainer.changeRegistrationMode('Restricted') }}
|
|
|
|
|
- >
|
|
|
|
|
- <a role="menuitem">{t('security_setting.registration_mode.restricted')}</a>
|
|
|
|
|
- </li>
|
|
|
|
|
- <li
|
|
|
|
|
- key="Closed"
|
|
|
|
|
- role="presentation"
|
|
|
|
|
- type="button"
|
|
|
|
|
- onClick={() => { adminLocalSecurityContainer.changeRegistrationMode('Closed') }}
|
|
|
|
|
- >
|
|
|
|
|
- <a role="menuitem">{t('security_setting.registration_mode.closed')}</a>
|
|
|
|
|
- </li>
|
|
|
|
|
- </ul>
|
|
|
|
|
|
|
+ <div className="row">
|
|
|
|
|
+ <div className="col-3 text-right py-2">
|
|
|
|
|
+ <strong>{t('Register limitation')}</strong>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="col-6">
|
|
|
|
|
+ <div className="dropdown">
|
|
|
|
|
+ <button
|
|
|
|
|
+ className="btn btn-light dropdown-toggle"
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ id="dropdownMenuButton"
|
|
|
|
|
+ data-toggle="dropdown"
|
|
|
|
|
+ aria-haspopup="true"
|
|
|
|
|
+ aria-expanded="true"
|
|
|
|
|
+ >
|
|
|
|
|
+ {registrationMode === 'Open' && t('security_setting.registration_mode.open')}
|
|
|
|
|
+ {registrationMode === 'Restricted' && t('security_setting.registration_mode.restricted')}
|
|
|
|
|
+ {registrationMode === 'Closed' && t('security_setting.registration_mode.closed')}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <div className="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
|
|
|
|
+ <a className="dropdown-item" onClick={() => { adminLocalSecurityContainer.changeRegistrationMode('Open') }}>
|
|
|
|
|
+ {t('security_setting.registration_mode.open')}
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <a className="dropdown-item" onClick={() => { adminLocalSecurityContainer.changeRegistrationMode('Restricted') }}>
|
|
|
|
|
+ {t('security_setting.registration_mode.restricted')}
|
|
|
|
|
+ </a>
|
|
|
|
|
+ <a className="dropdown-item" onClick={() => { adminLocalSecurityContainer.changeRegistrationMode('Closed') }}>
|
|
|
|
|
+ {t('security_setting.registration_mode.closed')}
|
|
|
|
|
+ </a>
|
|
|
</div>
|
|
</div>
|
|
|
- <p className="help-block">
|
|
|
|
|
- {t('security_setting.Register limitation desc')}
|
|
|
|
|
- </p>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ <p className="help-block small">
|
|
|
|
|
+ {t('security_setting.Register limitation desc')}
|
|
|
|
|
+ </p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div className="row mb-5">
|
|
|
|
|
- <strong className="col-xs-3 text-right" dangerouslySetInnerHTML={{ __html: t('The whitelist of registration permission E-mail address') }} />
|
|
|
|
|
- <div className="col-xs-6">
|
|
|
|
|
- <div>
|
|
|
|
|
- <textarea
|
|
|
|
|
- className="form-control"
|
|
|
|
|
- type="textarea"
|
|
|
|
|
- name="registrationWhiteList"
|
|
|
|
|
- defaultValue={adminLocalSecurityContainer.state.registrationWhiteList.join('\n')}
|
|
|
|
|
- onChange={e => adminLocalSecurityContainer.changeRegistrationWhiteList(e.target.value)}
|
|
|
|
|
- />
|
|
|
|
|
- <p className="help-block small">{t('security_setting.restrict_emails')}<br />{t('security_setting.for_instance')}
|
|
|
|
|
- <code>@growi.org</code>{t('security_setting.only_those')}<br />
|
|
|
|
|
- {t('security_setting.insert_single')}
|
|
|
|
|
- </p>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div className="row">
|
|
|
|
|
+ <div className="col-3 text-right">
|
|
|
|
|
+ <strong dangerouslySetInnerHTML={{ __html: t('The whitelist of registration permission E-mail address') }} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="col-6">
|
|
|
|
|
+ <textarea
|
|
|
|
|
+ className="form-control"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ name="registrationWhiteList"
|
|
|
|
|
+ defaultValue={adminLocalSecurityContainer.state.registrationWhiteList.join('\n')}
|
|
|
|
|
+ onChange={e => adminLocalSecurityContainer.changeRegistrationWhiteList(e.target.value)}
|
|
|
|
|
+ />
|
|
|
|
|
+ <p className="help-block small">{t('security_setting.restrict_emails')}<br />{t('security_setting.for_instance')}
|
|
|
|
|
+ <code>@growi.org</code>{t('security_setting.only_those')}<br />
|
|
|
|
|
+ {t('security_setting.insert_single')}
|
|
|
|
|
+ </p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div className="row my-3">
|
|
<div className="row my-3">
|
|
|
- <div className="col-xs-offset-3 col-xs-5">
|
|
|
|
|
|
|
+ <div className="offset-3 col-6">
|
|
|
<button
|
|
<button
|
|
|
type="button"
|
|
type="button"
|
|
|
className="btn btn-primary"
|
|
className="btn btn-primary"
|