summaryrefslogblamecommitdiffstats
path: root/templates/sysconfig/ad-selfsearch.html
blob: f77bd5fbbbf8227d5dd9a3e7d0c3fb9510acd8bf (plain) (tree)














































































                                                                                                                                 
<p>
	{{lang_dnLookup}}
</p>

<div id="zeug">
	<div data-tm-id="{{self-search}}" data-tm-log="messages" data-tm-callback="selfCb">LDAP Self-Query</div>
	<pre style="display:none" id="result"></pre>
</div>
<i>{{lang_onProblemSearchBase}}</i>
<br><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">
		{{#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 name="port" value="{{port}}" type="hidden">
		<input id="searchbase" name="searchbase" value="{{searchbase}}" type="hidden">
		<input id="fulldn" name="binddn" value="" type="hidden">
		<input id="givendn" name="originalbinddn" 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 type="hidden" name="certificate" value="{{certificate}}">
		{{/ssl}}
		<input name="fingerprint" value="{{fingerprint}}" type="hidden">
		<input name="originalbinddn" value="{{binddn}}" type="hidden">
		<button id="nextbutton" type="submit" class="btn btn-primary" style="display:none">{{lang_skip}} &raquo;</button>
	</form>
</div>
<script type="text/javascript">
	function selfCb(task)
	{
		if (!task || !task.statusCode || task.statusCode === 'TASK_WAITING' || task.statusCode === 'TASK_PROCESSING')
			return;
		if (task.statusCode === 'TASK_FINISHED' && task.data && task.data.dn) {
			var fulldn = task.data.dn;
			var domain = "-";
			var search = $('#searchbase').val();
			if ($('#searchbase').val().length < 2) {
				domain = $('#givendn').val().replace(/[\/\\]\S+$/i, '');
				var idx = fulldn.search(new RegExp('\\w+=' + domain + ',', "i"));
				console.log(idx);
				if (idx !== -1) {
					search = fulldn.substring(idx);
				}
				$('#searchbase').val(search);
			}
			$('#fulldn').val(fulldn);
			$('#result').text("BindDN: " + fulldn + "\nWinDomain: " + domain + "\nSearchBase: " + search).show();
			if (typeof search !== 'string' || search.length === 0 || search.length + 2 >= fulldn.length) {
				$('#nextbutton').html('{{lang_continueAnyway}}');
			} else {
				$('#nextform').submit();
			}
		} else {
			$('#nextbutton').html('{{lang_continueAnyway}}');
		}
		$('#nextbutton').show();
	}
</script>