Added a smarter way to determine the search dn

This commit is contained in:
Gregory Ballantine 2022-05-22 01:34:31 -04:00
parent 9d6cf1ad44
commit 62702cf741
2 changed files with 9 additions and 2 deletions

View File

@ -20,7 +20,7 @@ ldapGetUserList = () ->
document.querySelector('h1').textContent = 'error' document.querySelector('h1').textContent = 'error'
return return
else else
client.search('dc=example,dc=com', searchOpts, (err, res) -> client.search('ou=People,' + localStorage.getItem('ldap_base_dn'), searchOpts, (err, res) ->
if err if err
console.log(err) console.log(err)
return return

View File

@ -11,9 +11,16 @@ loginForm = (event) ->
document.querySelector('h1').textContent = 'error' document.querySelector('h1').textContent = 'error'
else else
document.querySelector('h1').textContent = 'Logged in!' document.querySelector('h1').textContent = 'Logged in!'
bindDn = document.forms.loginForm.bind_dn.value
baseDnBits = bindDn.split(',')
baseDnBits.shift()
baseDn = baseDnBits.join(',')
localStorage.setItem('ldap_hostname', document.forms.loginForm.ldap_host.value) localStorage.setItem('ldap_hostname', document.forms.loginForm.ldap_host.value)
localStorage.setItem('ldap_bind_dn', document.forms.loginForm.bind_dn.value) localStorage.setItem('ldap_bind_dn', bindDn)
localStorage.setItem('ldap_bind_pw', document.forms.loginForm.bind_pw.value) localStorage.setItem('ldap_bind_pw', document.forms.loginForm.bind_pw.value)
localStorage.setItem('ldap_base_dn', baseDn)
window.location.href = 'index.html' window.location.href = 'index.html'
return return
return return