diff options
author | Simon Rettberg | 2016-10-27 18:57:05 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-10-27 18:57:05 +0200 |
commit | f7b2aa8e3bb66f9c1c0dd3489152cc71bd1e7da8 (patch) | |
tree | 45a5efbd8b0418f53eecbf5bd0907ff1ea255a0a /modules-available/sysconfig/templates/ad-selfsearch.html | |
parent | [baseconfig_bwlp] Reintroduce SLX_REBOOT_SCHEDULE (diff) | |
download | slx-admin-f7b2aa8e3bb66f9c1c0dd3489152cc71bd1e7da8.tar.gz slx-admin-f7b2aa8e3bb66f9c1c0dd3489152cc71bd1e7da8.tar.xz slx-admin-f7b2aa8e3bb66f9c1c0dd3489152cc71bd1e7da8.zip |
[sysconfig] Improve binddn parsing for AD wizard
Diffstat (limited to 'modules-available/sysconfig/templates/ad-selfsearch.html')
-rw-r--r-- | modules-available/sysconfig/templates/ad-selfsearch.html | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/modules-available/sysconfig/templates/ad-selfsearch.html b/modules-available/sysconfig/templates/ad-selfsearch.html index dad5a24f..5fadd92e 100644 --- a/modules-available/sysconfig/templates/ad-selfsearch.html +++ b/modules-available/sysconfig/templates/ad-selfsearch.html @@ -42,7 +42,7 @@ <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 id="givendn" name="originalbinddn" value="{{originalbinddn}}" type="hidden"> <input name="bindpw" value="{{bindpw}}" type="hidden"> <input id="home" name="home" value="{{home}}" type="hidden"> <input id="homeattr" name="homeattr" value="{{homeattr}}" type="hidden"> @@ -64,11 +64,18 @@ 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); + var givenDn = $('#givendn').val(); + if (new RegExp('^\\w+[\\/\\\\]\\w+$').test(givenDn)) { + domain = givenDn.replace(/[\/\\]\S+$/i, ''); + var idx = fulldn.search(new RegExp('\\w+=' + domain + ',', "i")); + if (idx !== -1) { + search = fulldn.substring(idx); + } + } else { + var idx = givenDn.toLowerCase().indexOf(',dc='); + if (idx !== -1) { + search = givenDn.substring(idx + 1); + } } $('#searchbase').val(search); } |