Added a basic user list
This commit is contained in:
parent
866754cf3f
commit
9d6cf1ad44
@ -1,3 +1,44 @@
|
|||||||
|
ldap = require('ldapjs')
|
||||||
|
|
||||||
|
userTable = {}
|
||||||
|
|
||||||
window.onload = ->
|
window.onload = ->
|
||||||
document.getElementById('ldapHost').textContent = localStorage.getItem('ldap_hostname')
|
document.getElementById('ldapHost').textContent = localStorage.getItem('ldap_hostname')
|
||||||
|
userTable = document.getElementById('ldapUserList')
|
||||||
|
ldapGetUserList()
|
||||||
return
|
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
|
body
|
||||||
|
padding-bottom: 115px
|
||||||
background: white
|
background: white
|
||||||
|
|
||||||
a
|
a
|
||||||
color: cornflowerblue
|
color: cornflowerblue
|
||||||
|
transition: all 200ms ease-in-out
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
color: darken(cornflowerblue, 10%)
|
||||||
|
|
||||||
|
input
|
||||||
|
transition: all 200ms ease-in-out
|
||||||
|
|
||||||
input[type=submit],
|
input[type=submit],
|
||||||
button
|
button
|
||||||
background-color: cornflowerblue
|
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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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 %}
|
{% endblock %}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
<link rel="stylesheet" href="./styles/skeleton-2.0.4.min.css">
|
<link rel="stylesheet" href="./styles/skeleton-2.0.4.min.css">
|
||||||
<link rel="stylesheet" href="./styles/archon.css">
|
<link rel="stylesheet" href="./styles/archon.css">
|
||||||
<title>Hello World!</title>
|
<title>Hello World!</title>
|
||||||
|
<script src="./js/archon.js" charset="utf-8"></script>
|
||||||
{% block scripts %}{% endblock %}
|
{% block scripts %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -14,8 +15,20 @@
|
|||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
We are using Node.js <span id="node-version"></span>,
|
<footer id="footer">
|
||||||
Chromium <span id="chrome-version"></span>,
|
<div class="container fluid">
|
||||||
and Electron <span id="electron-version"></span>.
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -5,24 +5,38 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Login</h1>
|
<header id="header" class="row">
|
||||||
|
<div class="columns twelve">
|
||||||
|
<h1>Login</h1>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
<form id="loginForm">
|
<div class="row">
|
||||||
<label>
|
<form id="loginForm" class="columns twelve">
|
||||||
LDAP Host:
|
<div class="row">
|
||||||
<input type="text" name="ldap_host" placeholder="Enter LDAP host...">
|
<label class="columns twelve">
|
||||||
</label>
|
LDAP Host:
|
||||||
|
<input class="u-full-width" type="text" name="ldap_host" placeholder="Enter LDAP host...">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label>
|
<div class="row">
|
||||||
Bind DN:
|
<label class="columns six">
|
||||||
<input type="text" name="bind_dn" placeholder="Enter bind DN...">
|
Bind DN:
|
||||||
</label>
|
<input class="u-full-width" type="text" name="bind_dn" placeholder="Enter bind DN...">
|
||||||
|
</label>
|
||||||
|
|
||||||
<label>
|
<label class="columns six">
|
||||||
Bind Password:
|
Bind Password:
|
||||||
<input type="text" name="bind_pw" placeholder="Enter bind DN...">
|
<input class="u-full-width" type="text" name="bind_pw" placeholder="Enter bind DN...">
|
||||||
</label>
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="submit" name="bind_submit" value="Login">
|
<div class="row">
|
||||||
</form>
|
<div class="columns twelve u-text-center">
|
||||||
|
<input type="submit" name="bind_submit" value="Login">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user