local.html 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <form action="/_api/admin/security/passport-local" method="post" class="form-horizontal passportStrategy" id="localSetting" role="form"
  2. {% if isRestartingServerNeeded %}style="opacity: 0.4;"{% endif %}>
  3. <legend class="alert-anchor">{{ t("security_setting.Local.name") }} {{ t("security_setting.configuration") }}</legend>
  4. {% set nameForIsLocalEnabled = "settingForm[security:passport-local:isEnabled]" %}
  5. {% set isLocalEnabled = getConfig('crowi', 'security:passport-local:isEnabled') %}
  6. {% set useOnlyEnvVars = getConfig('crowi', 'security:passport-local:useOnlyEnvVarsForSomeOptions') %}
  7. <!-- TODO delete file after reactify-admin -->
  8. {% if useOnlyEnvVars %}
  9. <p class="alert alert-info">
  10. {{ t("security_setting.Local.note for the only env option", "LOCAL_STRATEGY_USES_ONLY_ENV_VARS_FOR_SOME_OPTIONS") }}
  11. </p>
  12. {% endif %}
  13. <div class="form-group">
  14. <label for="{{nameForIsLocalEnabled}}" class="col-xs-3 control-label">{{ t("security_setting.Local.name") }}</label>
  15. <div class="col-xs-6">
  16. <div class="btn-group btn-toggle {% if useOnlyEnvVars %}btn-group-disabled{% endif %}" data-toggle="buttons">
  17. <label class="btn btn-default btn-rounded btn-outline {% if isLocalEnabled %}active{% endif %}" data-active-class="primary">
  18. <input name="{{nameForIsLocalEnabled}}"
  19. value="true"
  20. type="radio"
  21. {% if true === isLocalEnabled %}checked{% endif %}
  22. {% if useOnlyEnvVars %}readonly{% endif %}> ON
  23. </label>
  24. <label class="btn btn-default btn-rounded btn-outline {% if !isLocalEnabled %}active{% endif %}" data-active-class="default">
  25. <input name="{{nameForIsLocalEnabled}}"
  26. value="false"
  27. type="radio"
  28. {% if !isLocalEnabled %}checked{% endif %}
  29. {% if useOnlyEnvVars %}readonly{% endif %}> OFF
  30. </label>
  31. </div>
  32. </div>
  33. </div>
  34. <fieldset id="passport-local-hide-when-disabled" {%if !isLocalEnabled %}style="display: none;"{% endif %}>
  35. <div class="form-group">
  36. <label for="settingForm[security:registrationMode]" class="col-xs-3 control-label">{{ t('Register limitation') }}</label>
  37. <div class="col-xs-9 col-lg-6">
  38. <select class="form-control selectpicker" name="settingForm[security:registrationMode]" value="{{ getConfig('crowi', 'security:registrationMode') }}">
  39. {% for modeValue, modeLabel in consts.registrationMode %}
  40. <option value="{{ t(modeValue) }}" {% if modeValue == getConfig('crowi', 'security:registrationMode') %}selected{% endif %} >{{ t(modeLabel) }}</option>
  41. {% endfor %}
  42. </select>
  43. <p class="help-block small">{{ t('security_setting.Register limitation desc') }}</p>
  44. </div>
  45. </div>
  46. <div class="form-group">
  47. <label for="settingForm[security:registrationWhiteList]" class="col-xs-3 control-label">{{ t('The whitelist of registration permission E-mail address') }}</label>
  48. <div class="col-xs-9 col-lg-6">
  49. <textarea class="form-control" type="textarea" name="settingForm[security:registrationWhiteList]" placeholder="{{ t('security_setting.example') }}: @growi.org">{{ getConfig('crowi', 'security:registrationWhiteList') | join('&#13') | raw }}</textarea>
  50. <p class="help-block small">{{ t("security_setting.restrict_emails") }}{{ t("security_setting.for_instance") }}<code>@growi.org</code>{{ t("security_setting.only_those") }}<br>
  51. {{ t("security_setting.insert_single") }}</p>
  52. </div>
  53. </div>
  54. </fieldset>
  55. <div class="form-group" id="btn-update">
  56. <div class="col-xs-offset-3 col-xs-6">
  57. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  58. <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
  59. </div>
  60. </div>
  61. </form>
  62. <script>
  63. $('input[name="settingForm[security:passport-local:isEnabled]"]').change(function() {
  64. const isEnabled = ($(this).val() === "true");
  65. if (isEnabled) {
  66. $('#passport-local-hide-when-disabled').show(400);
  67. }
  68. else {
  69. $('#passport-local-hide-when-disabled').hide(400);
  70. }
  71. });
  72. </script>