basic.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <form action="/_api/admin/security/passport-basic" method="post" class="form-horizontal passportStrategy" id="basicSetting" role="form"
  2. {% if isRestartingServerNeeded %}style="opacity: 0.4;"{% endif %}>
  3. <legend class="alert-anchor">{{ t("security_setting.Basic authentication") }} {{ t("security_setting.configuration") }}</legend>
  4. {% set nameForIsbasicEnabled = "settingForm[security:passport-basic:isEnabled]" %}
  5. {% set isbasicEnabled = settingForm['security:passport-basic:isEnabled'] %}
  6. <div class="form-group">
  7. <label for="{{nameForIsbasicEnabled}}" class="col-xs-3 control-label">{{ t("security_setting.Basic authentication") }}</label>
  8. <div class="col-xs-6">
  9. <div class="btn-group btn-toggle" data-toggle="buttons">
  10. <label class="btn btn-default btn-rounded btn-outline {% if isbasicEnabled %}active{% endif %}" data-active-class="primary">
  11. <input name="{{nameForIsbasicEnabled}}" value="true" type="radio"
  12. {% if true === isbasicEnabled %}checked{% endif %}> ON
  13. </label>
  14. <label class="btn btn-default btn-rounded btn-outline {% if !isbasicEnabled %}active{% endif %}" data-active-class="default">
  15. <input name="{{nameForIsbasicEnabled}}" value="false" type="radio"
  16. {% if !isbasicEnabled %}checked{% endif %}> OFF
  17. </label>
  18. </div>
  19. </div>
  20. </div>
  21. <fieldset id="passport-basic-hide-when-disabled" {%if !isbasicEnabled %}style="display: none;"{% endif %}>
  22. <div class="form-group">
  23. <label for="settingForm[security:passport-basic:id]" class="col-xs-3 control-label">ID</label>
  24. <div class="col-xs-6">
  25. <input class="form-control" type="text" name="settingForm[security:passport-basic:id]" value="{{ settingForm['security:passport-basic:id'] || '' }}">
  26. </div>
  27. </div>
  28. <div class="form-group">
  29. <label for="settingForm[security:passport-basic:password]" class="col-xs-3 control-label">{{ t("Password") }}</label>
  30. <div class="col-xs-6">
  31. <input class="form-control" type="text" name="settingForm[security:passport-basic:password]" value="{{ settingForm['security:passport-basic:password'] || '' }}">
  32. </div>
  33. </div>
  34. </fieldset>
  35. <div class="form-group" id="btn-update">
  36. <div class="col-xs-offset-3 col-xs-6">
  37. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  38. <button type="submit" class="btn btn-primary">{{ t('Update') }}</button>
  39. </div>
  40. </div>
  41. </form>
  42. <script>
  43. $('input[name="settingForm[security:passport-basic:isEnabled]"]').change(function() {
  44. const isEnabled = ($(this).val() === "true");
  45. if (isEnabled) {
  46. $('#passport-basic-hide-when-disabled').show(400);
  47. }
  48. else {
  49. $('#passport-basic-hide-when-disabled').hide(400);
  50. }
  51. });
  52. </script>