diff --git a/assets/coffee/index.coffee b/assets/coffee/index.coffee index 1c8c0ff..968c5f5 100644 --- a/assets/coffee/index.coffee +++ b/assets/coffee/index.coffee @@ -1,3 +1,44 @@ +ldap = require('ldapjs') + +userTable = {} + window.onload = -> document.getElementById('ldapHost').textContent = localStorage.getItem('ldap_hostname') + userTable = document.getElementById('ldapUserList') + ldapGetUserList() return + +searchOpts = + filter: '(objectClass=posixAccount)' + scope: 'sub' + attributes: ['uid', 'displayName', 'mail'] + +ldapGetUserList = () -> + client = ldap.createClient(url: 'ldap://' + localStorage.getItem('ldap_hostname') + '/') + client.bind(localStorage.getItem('ldap_bind_dn'), localStorage.getItem('ldap_bind_pw'), (err) -> + if err + document.querySelector('h1').textContent = 'error' + return + else + client.search('dc=example,dc=com', searchOpts, (err, res) -> + if err + console.log(err) + return + else + res.on('searchEntry', (entry) -> + userEntry = document.createElement('tr') + + userUid = document.createElement('td') + userUid.innerText = entry.object.uid + userEntry.appendChild(userUid) + userName = document.createElement('td') + userName.innerText = entry.object.displayName + userEntry.appendChild(userName) + userMail = document.createElement('td') + userMail.innerText = entry.object.mail + userEntry.appendChild(userMail) + + userTable.appendChild(userEntry) + ) + ) + ) diff --git a/assets/sass/archon.sass b/assets/sass/archon.sass index e991059..5abeb32 100644 --- a/assets/sass/archon.sass +++ b/assets/sass/archon.sass @@ -1,10 +1,53 @@ body + padding-bottom: 115px background: white a color: cornflowerblue + transition: all 200ms ease-in-out + + &:hover + color: darken(cornflowerblue, 10%) + +input + transition: all 200ms ease-in-out input[type=submit], button background-color: cornflowerblue - color: white + color: #f0f0f0 + transition: all 200ms ease-in-out + + &:hover + background-color: darken(cornflowerblue, 10%) + color: white + +.u-text-center + text-align: center + +.container + max-width: 1024px + +.container.fluid + max-width: 100% + +#header h1 + text-align: center + +#footer + position: fixed + left: 0 + right: 0 + bottom: 0 + padding-top: 25px + padding-bottom: 25px + border-top: 1px solid #999 + + .row + position: relative + + p.no-margin + margin-bottom: 0 + +#ldapObjectTable table + width: 100% diff --git a/assets/twig/index.twig b/assets/twig/index.twig index 47b21d3..430379b 100644 --- a/assets/twig/index.twig +++ b/assets/twig/index.twig @@ -5,7 +5,28 @@ {% endblock %} {% block content %} -

Users Page

+
+
+

Archon LDAP Manager

+
+
-

+
+
+

Connected to:

+
+
+ +
+ + + + + + + + + +
User IDDisplay NameEmail Address
+
{% endblock %} diff --git a/assets/twig/layout.twig b/assets/twig/layout.twig index 6fe2afd..d1cd131 100644 --- a/assets/twig/layout.twig +++ b/assets/twig/layout.twig @@ -7,6 +7,7 @@ Hello World! + {% block scripts %}{% endblock %} @@ -14,8 +15,20 @@ {% block content %}{% endblock %} - We are using Node.js , - Chromium , - and Electron . + diff --git a/assets/twig/login.twig b/assets/twig/login.twig index 37ce5c0..ee88fb3 100644 --- a/assets/twig/login.twig +++ b/assets/twig/login.twig @@ -5,24 +5,38 @@ {% endblock %} {% block content %} -

Login

+ -
- +
+ +
+ +
- +
+ - + +
- - +
+
+ +
+
+ +
{% endblock %}