summaryrefslogtreecommitdiffstats
path: root/modules-available/sysconfig/templates/ad_ldap-checkconnection.html
diff options
context:
space:
mode:
authorSimon Rettberg2016-05-03 19:03:09 +0200
committerSimon Rettberg2016-05-03 19:03:09 +0200
commit50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66 (patch)
tree05e99fdffa696434960d7c77966c0bc36d6339e8 /modules-available/sysconfig/templates/ad_ldap-checkconnection.html
parentSecond half of merge.... (diff)
downloadslx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.tar.gz
slx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.tar.xz
slx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.zip
WIP
Diffstat (limited to 'modules-available/sysconfig/templates/ad_ldap-checkconnection.html')
-rw-r--r--modules-available/sysconfig/templates/ad_ldap-checkconnection.html91
1 files changed, 91 insertions, 0 deletions
diff --git a/modules-available/sysconfig/templates/ad_ldap-checkconnection.html b/modules-available/sysconfig/templates/ad_ldap-checkconnection.html
new file mode 100644
index 00000000..5925829a
--- /dev/null
+++ b/modules-available/sysconfig/templates/ad_ldap-checkconnection.html
@@ -0,0 +1,91 @@
+<p>
+ {{lang_connectionWait}}
+</p>
+
+<div id="zeug">
+ <div data-tm-id="{{taskid}}" data-tm-log="messages" data-tm-callback="portScan">Port Check</div>
+</div>
+<div id="self-signed" style="display:none" class="alert alert-info">{{lang_selfSignedNote}}</div>
+<div id="no-valid-cert" style="display:none" class="alert alert-danger">{{lang_noValidCert}}</div>
+<div id="no-open-port" style="display:none" class="alert alert-danger">{{lang_noOpenPort}}</div>
+<br>
+<div class="pull-left">
+ <form role="form" method="post" action="?do=SysConfig&amp;action=addmodule&amp;step={{prev}}">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="edit" value="{{edit}}">
+ <input name="title" value="{{title}}" type="hidden">
+ <input name="server" value="{{server}}" type="hidden">
+ <input name="searchbase" value="{{searchbase}}" type="hidden">
+ <input name="binddn" value="{{binddn}}" type="hidden">
+ <input name="bindpw" value="{{bindpw}}" type="hidden">
+ <input name="home" value="{{home}}" type="hidden">
+ <input name="homeattr" value="{{homeattr}}" type="hidden">
+ {{#ssl}}
+ <input name="ssl" value="on" type="hidden">
+ <input type="hidden" name="certificate" value="{{certificate}}">
+ {{/ssl}}
+ <button type="submit" class="btn btn-primary">&laquo; {{lang_back}}</button>
+ </form>
+</div>
+<div class="pull-right">
+ <form id="nextform" role="form" method="post" action="?do=SysConfig&amp;action=addmodule&amp;step={{next}}">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="edit" value="{{edit}}">
+ <input name="title" value="{{title}}" type="hidden">
+ <input name="server" value="{{server}}" type="hidden">
+ <input id="port" name="port" value="" type="hidden">
+ <input name="searchbase" value="{{searchbase}}" type="hidden">
+ <input name="binddn" value="{{binddn}}" type="hidden">
+ <input name="bindpw" value="{{bindpw}}" type="hidden">
+ <input name="home" value="{{home}}" type="hidden">
+ <input name="homeattr" value="{{homeattr}}" type="hidden">
+ {{#ssl}}
+ <input id="ssl" name="ssl" value="on" type="hidden">
+ <input id="fingerprint" name="fingerprint" value="" type="hidden">
+ <input id="certificate" type="hidden" name="certificate" value="{{certificate}}">
+ {{/ssl}}
+ <input name="originalbinddn" value="{{binddn}}" type="hidden">
+ <button id="nextbutton" type="submit" class="btn btn-primary" style="display:none">{{lang_next}} &raquo;</button>
+ </form>
+</div>
+<div id="bla"></div>
+<script type="text/javascript">
+ function isSelfSigned(code)
+ {
+ return code == 18 || code == 19 || code == 20 || code == 21;
+ }
+ function portScan(task)
+ {
+ if (!task || !task.statusCode)
+ return;
+ if (task.statusCode === 'TASK_FINISHED' && task.data && task.data.ports) {
+ var ssl = $('#ssl').length > 0;
+ var ports = task.data.ports;
+ var verRes = -1;
+ var cert = ssl && $('#certificate').val().length > 10;
+ for (var i = 0; i < ports.length; ++i) {
+ if (!ports[i].open || !ports[i].port) continue;
+ if ($.isNumeric($('#port').val()) && $('#port').val() < ports[i].port) continue; // Prefer the global LDAP ports over the specific AD ports
+ if (ssl) {
+ if (verRes === -1) verRes = ports[i].verifyResult;
+ if (ports[i].certFingerprint.length < 10 || ports[i].certificateChain.length < 10) continue;
+ if (ports[i].verifyResult != 0 && (cert || !isSelfSigned(ports[i].verifyResult))) continue;
+ verRes = ports[i].verifyResult;
+ $('#fingerprint').val(ports[i].certFingerprint);
+ if (!cert && verRes != 0) $('#certificate').val(ports[i].certificateChain);
+ else if (!cert && verRes == 0) $('#certificate').val('default');
+ }
+ $('#port').val(ports[i].port);
+ }
+ if (ssl && verRes != 0 && (cert || !isSelfSigned(verRes))) {
+ $('#no-valid-cert').css('display', '');
+ } else if ($('#port').val() > 0) {
+ $('#nextbutton').show();
+ if (ssl && isSelfSigned(verRes)) $('#self-signed').css('display', '');
+ else $('#nextform').submit();
+ } else {
+ $('#no-open-port').css('display', '');
+ }
+ }
+ }
+</script>