Added SASS CoffeeScript compilation through Grunt.js

This commit is contained in:
2022-05-24 18:18:56 -04:00
parent 59f3a45347
commit 15585bac29
9 changed files with 3108 additions and 3 deletions

View File

@ -0,0 +1,2 @@
@loadPage = (pagePath) ->
window.location.href = pagePath + '.html'

View 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)
)
)
)

View 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

View 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
View 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%