Added a basic user list
This commit is contained in:
parent
866754cf3f
commit
9d6cf1ad44
@ -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)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -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%
|
||||
|
@ -5,7 +5,28 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Users Page</h1>
|
||||
<header class="row">
|
||||
<div class="columns twelve u-text-center">
|
||||
<h1>Archon LDAP Manager</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<p id="ldapHost"></p>
|
||||
<section id="connectionInfo" class="row">
|
||||
<div class="columns twelve u-text-center">
|
||||
<p>Connected to: <span id="ldapHost"></span></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="ldapObjectTable" class="row">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User ID</th>
|
||||
<th>Display Name</th>
|
||||
<th>Email Address</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="ldapUserList"></tbody>
|
||||
</table>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
@ -7,6 +7,7 @@
|
||||
<link rel="stylesheet" href="./styles/skeleton-2.0.4.min.css">
|
||||
<link rel="stylesheet" href="./styles/archon.css">
|
||||
<title>Hello World!</title>
|
||||
<script src="./js/archon.js" charset="utf-8"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
@ -14,8 +15,20 @@
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
We are using Node.js <span id="node-version"></span>,
|
||||
Chromium <span id="chrome-version"></span>,
|
||||
and Electron <span id="electron-version"></span>.
|
||||
<footer id="footer">
|
||||
<div class="container fluid">
|
||||
<div class="row">
|
||||
<div class="columns three"><p></p></div>
|
||||
<div class="columns six">
|
||||
<p class="no-margin">This app was built using:</p>
|
||||
<p class="no-margin">
|
||||
Node.js <span id="node-version"></span>,
|
||||
Chromium <span id="chrome-version"></span>,
|
||||
and Electron <span id="electron-version"></span>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -5,24 +5,38 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Login</h1>
|
||||
<header id="header" class="row">
|
||||
<div class="columns twelve">
|
||||
<h1>Login</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<form id="loginForm">
|
||||
<label>
|
||||
LDAP Host:
|
||||
<input type="text" name="ldap_host" placeholder="Enter LDAP host...">
|
||||
</label>
|
||||
<div class="row">
|
||||
<form id="loginForm" class="columns twelve">
|
||||
<div class="row">
|
||||
<label class="columns twelve">
|
||||
LDAP Host:
|
||||
<input class="u-full-width" type="text" name="ldap_host" placeholder="Enter LDAP host...">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label>
|
||||
Bind DN:
|
||||
<input type="text" name="bind_dn" placeholder="Enter bind DN...">
|
||||
</label>
|
||||
<div class="row">
|
||||
<label class="columns six">
|
||||
Bind DN:
|
||||
<input class="u-full-width" type="text" name="bind_dn" placeholder="Enter bind DN...">
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Bind Password:
|
||||
<input type="text" name="bind_pw" placeholder="Enter bind DN...">
|
||||
</label>
|
||||
<label class="columns six">
|
||||
Bind Password:
|
||||
<input class="u-full-width" type="text" name="bind_pw" placeholder="Enter bind DN...">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<input type="submit" name="bind_submit" value="Login">
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="columns twelve u-text-center">
|
||||
<input type="submit" name="bind_submit" value="Login">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user