|
|
@@ -129,84 +129,84 @@
|
|
|
<button type="submit" class="btn btn-primary">{# the first element is the default button to submit #}
|
|
|
{{ t('Update') }}
|
|
|
</button>
|
|
|
- <button type="submit" formaction="/_api/admin/security/passport-ldap-test"
|
|
|
+ <button type="submit"
|
|
|
class="btn btn-default passport-ldap-hide-when-disabled"
|
|
|
+ data-target="#test-ldap-account" data-toggle="modal"
|
|
|
{%if !isLdapEnabled %}style="display: none;"{% endif %}>
|
|
|
- (TBD) Test to bind
|
|
|
+
|
|
|
+ Test Saved Configuration
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</fieldset>
|
|
|
<input type="hidden" name="_csrf" value="{{ csrf() }}">
|
|
|
|
|
|
-</form>
|
|
|
+ <script>
|
|
|
+ // switch display according to on / off of radio buttons
|
|
|
+ $('input[name="{{nameForIsLdapEnabled}}"]:radio').change(function() {
|
|
|
+ const isEnabled = ($(this).val() === "true");
|
|
|
+
|
|
|
+ if (isEnabled) {
|
|
|
+ $('.passport-ldap-hide-when-disabled').show(400);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $('.passport-ldap-hide-when-disabled').hide(400);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
-<script>
|
|
|
- // switch display according to on / off of radio buttons
|
|
|
- $('input[name="{{nameForIsLdapEnabled}}"]:radio').change(function() {
|
|
|
- const isEnabled = ($(this).val() === "true");
|
|
|
+ // switch display according to on / off of radio buttons
|
|
|
+ $('input[name="{{nameForIsUserBind}}"]:radio').change(function() {
|
|
|
+ const isUserBind = ($(this).val() === "true");
|
|
|
|
|
|
- if (isEnabled) {
|
|
|
- $('.passport-ldap-hide-when-disabled').show(400);
|
|
|
- }
|
|
|
- else {
|
|
|
- $('.passport-ldap-hide-when-disabled').hide(400);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (isUserBind) {
|
|
|
+ $('input.passport-ldap-managerbind').hide();
|
|
|
+ $('.help-block.passport-ldap-managerbind').hide();
|
|
|
+ $('.help-block.passport-ldap-userbind').show();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $('input.passport-ldap-managerbind').show();
|
|
|
+ $('.help-block.passport-ldap-managerbind').show();
|
|
|
+ $('.help-block.passport-ldap-userbind').hide();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // switch display according to on / off of radio buttons
|
|
|
- $('input[name="{{nameForIsUserBind}}"]:radio').change(function() {
|
|
|
- const isUserBind = ($(this).val() === "true");
|
|
|
+ // store which button is clicked when submit
|
|
|
+ var submittedButton;
|
|
|
+ $('button[type="submit"]').click(function() {
|
|
|
+ submittedButton = $(this);
|
|
|
+ });
|
|
|
+ $('#ldapSetting, #ldapTest').each(function() {
|
|
|
+ $(this).submit(function()
|
|
|
+ {
|
|
|
+ function showMessage(formId, msg, status) {
|
|
|
+ $('#' + formId + ' .alert').remove();
|
|
|
|
|
|
- if (isUserBind) {
|
|
|
- $('input.passport-ldap-managerbind').hide();
|
|
|
- $('.help-block.passport-ldap-managerbind').hide();
|
|
|
- $('.help-block.passport-ldap-userbind').show();
|
|
|
- }
|
|
|
- else {
|
|
|
- $('input.passport-ldap-managerbind').show();
|
|
|
- $('.help-block.passport-ldap-managerbind').show();
|
|
|
- $('.help-block.passport-ldap-userbind').hide();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // store which button is clicked when submit
|
|
|
- var submittedButton;
|
|
|
- $('button[type="submit"]').click(function() {
|
|
|
- submittedButton = $(this);
|
|
|
- });
|
|
|
- $('#ldapSetting, #ldapTest').each(function() {
|
|
|
- $(this).submit(function()
|
|
|
- {
|
|
|
- function showMessage(formId, msg, status) {
|
|
|
- $('#' + formId + ' .alert').remove();
|
|
|
-
|
|
|
- if (!status) {
|
|
|
- status = 'success';
|
|
|
- }
|
|
|
- var $message = $('<p class="alert"></p>');
|
|
|
- $message.addClass('alert-' + status);
|
|
|
- $message.html(msg.replace('\n', '<br>'));
|
|
|
- $message.insertAfter('#' + formId + ' legend');
|
|
|
-
|
|
|
- if (status == 'success') {
|
|
|
- setTimeout(function()
|
|
|
- {
|
|
|
- $message.fadeOut({
|
|
|
- complete: function() {
|
|
|
- $message.remove();
|
|
|
- }
|
|
|
- });
|
|
|
- }, 5000);
|
|
|
+ if (!status) {
|
|
|
+ status = 'success';
|
|
|
+ }
|
|
|
+ var $message = $('<p class="alert"></p>');
|
|
|
+ $message.addClass('alert-' + status);
|
|
|
+ $message.html(msg.replace('\n', '<br>'));
|
|
|
+ $message.insertAfter('#' + formId + ' legend');
|
|
|
+
|
|
|
+ if (status == 'success') {
|
|
|
+ setTimeout(function()
|
|
|
+ {
|
|
|
+ $message.fadeOut({
|
|
|
+ complete: function() {
|
|
|
+ $message.remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, 5000);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- var $form = $(this);
|
|
|
- var $id = $form.attr('id');
|
|
|
- var $button = submittedButton;
|
|
|
- var $action = $button.attr('formaction') || $form.attr('action');
|
|
|
- $button.attr('disabled', 'disabled');
|
|
|
- var jqxhr = $.post($action, $form.serialize(), function(data)
|
|
|
+ var $form = $(this);
|
|
|
+ var $id = $form.attr('id');
|
|
|
+ var $button = submittedButton;
|
|
|
+ var $action = $button.attr('formaction') || $form.attr('action');
|
|
|
+ $button.attr('disabled', 'disabled');
|
|
|
+ var jqxhr = $.post($action, $form.serialize(), function(data)
|
|
|
{
|
|
|
if (data.status) {
|
|
|
const message = data.message || '更新しました';
|
|
|
@@ -220,8 +220,42 @@
|
|
|
})
|
|
|
.always(function() {
|
|
|
$button.prop('disabled', false);
|
|
|
+ });
|
|
|
+ return false;
|
|
|
});
|
|
|
- return false;
|
|
|
});
|
|
|
- });
|
|
|
-</script>
|
|
|
+ </script>
|
|
|
+
|
|
|
+</form>
|
|
|
+
|
|
|
+<div class="modal test-ldap-account" id="test-ldap-account">
|
|
|
+ <div class="modal-dialog">
|
|
|
+ <div class="modal-content">
|
|
|
+
|
|
|
+ <div class="modal-header">
|
|
|
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
|
+ <h4 class="modal-title">{{ t('Test LDAP Account') }}</h4>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="modal-body">
|
|
|
+
|
|
|
+ {% include '../../../widget/passport/ldap-association-tester.html' %}
|
|
|
+
|
|
|
+ </div><!-- /.modal-body -->
|
|
|
+
|
|
|
+ </div><!-- /.modal-content -->
|
|
|
+ </div><!-- /.modal-dialog -->
|
|
|
+
|
|
|
+ <script>
|
|
|
+ /**
|
|
|
+ * associate (submit the form)
|
|
|
+ */
|
|
|
+ function associateLdap() {
|
|
|
+ var $form = $('#formLdapAssociationContainer > form');
|
|
|
+ var $action = '/me/external-accounts/associateLdap';
|
|
|
+ $form.attr('action', $action);
|
|
|
+ $form.submit();
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+
|
|
|
+</div><!-- /.modal -->
|