summaryrefslogtreecommitdiffstats
path: root/templates/sysconfig/ldap-checkconnection.html
blob: 394085263aa010cf513ba2ac25c48e5a92981a89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<p>
	{{lang_connectionWait}}
</p>

<div id="zeug">
	<div data-tm-id="{{taskid}}" data-tm-log="messages" data-tm-callback="portScan">Port Check</div>
</div>
<br>
<div class="pull-left">
	<form role="form" method="post" action="?do=SysConfig&amp;action=addmodule&amp;step=LdapAuth_Start">
		<input type="hidden" name="token" value="{{token}}">
		<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">
		{{#ssl}}
		<input id="ssl" name="ssl" value="on" type="hidden">
		{{/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={{step}}">
		<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">
		{{#ssl}}
		<input name="ssl" value="on" type="hidden">
		<input id="fingerprint" name="fingerprint" value="" type="hidden">
		{{/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 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;
			for (var i = 0; i < ports.length; ++i) {
				if (ports[i].open && ports[i].port && (!ssl || ports[i].certFingerprint.length > 10)) {
					if ($.isNumeric($('#port').val()) && $('#port').val() < ports[i].port) continue; // Prefer the global LDAP ports
					$('#port').val(ports[i].port);
					if (ssl) $('#fingerprint').val(ports[i].certFingerprint);
				}
			}
			if ($('#port').val() > 0) {
				$('#nextbutton').show();
				$('#nextform').submit();
			}
		}
	}
</script>