Added SASS CoffeeScript compilation through Grunt.js
This commit is contained in:
2
assets/coffee/archon.coffee
Normal file
2
assets/coffee/archon.coffee
Normal file
@ -0,0 +1,2 @@
|
||||
@loadPage = (pagePath) ->
|
||||
window.location.href = pagePath + '.html'
|
44
assets/coffee/index.coffee
Normal file
44
assets/coffee/index.coffee
Normal file
@ -0,0 +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('ou=People,' + localStorage.getItem('ldap_base_dn'), 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)
|
||||
)
|
||||
)
|
||||
)
|
30
assets/coffee/login.coffee
Normal file
30
assets/coffee/login.coffee
Normal file
@ -0,0 +1,30 @@
|
||||
ldap = require('ldapjs')
|
||||
|
||||
loginForm = (event) ->
|
||||
event.preventDefault()
|
||||
bindHost = document.forms.loginForm.ldap_host.value
|
||||
bindDn = document.forms.loginForm.bind_dn.value
|
||||
bindPw = document.forms.loginForm.bind_pw.value
|
||||
client = ldap.createClient(url: 'ldap://' + bindHost + '/')
|
||||
client.bind bindDn, bindPw, (err) ->
|
||||
if err
|
||||
document.querySelector('h1').textContent = 'error'
|
||||
else
|
||||
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_bind_dn', bindDn)
|
||||
localStorage.setItem('ldap_bind_pw', document.forms.loginForm.bind_pw.value)
|
||||
localStorage.setItem('ldap_base_dn', baseDn)
|
||||
|
||||
loadPage('index')
|
||||
return
|
||||
return
|
||||
|
||||
window.onload = ->
|
||||
document.getElementById('loginForm').addEventListener('submit', loginForm)
|
||||
return
|
9
assets/coffee/user.coffee
Normal file
9
assets/coffee/user.coffee
Normal file
@ -0,0 +1,9 @@
|
||||
userCreateFormSubmit = (e) ->
|
||||
e.preventDefault()
|
||||
|
||||
user_uid = document.forms.createUserForm.user_username.value
|
||||
console.log(user_uid)
|
||||
|
||||
window.onload = ->
|
||||
document.getElementById('createUserForm').addEventListener('submit', userCreateFormSubmit)
|
||||
return
|
53
assets/sass/archon.sass
Normal file
53
assets/sass/archon.sass
Normal file
@ -0,0 +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: #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%
|
Reference in New Issue
Block a user