mirror of
https://github.com/Hopiu/webapi-eca.git
synced 2026-05-26 23:54:03 +00:00
21 lines
588 B
CoffeeScript
21 lines
588 B
CoffeeScript
|
|
fOnLoad = () ->
|
|
document.title = 'Login'
|
|
$( '#pagetitle' ).text 'Login!'
|
|
|
|
if not window.CryptoJS
|
|
$( '#info' ).text 'CryptoJS library missing! Are you connected to the internet?'
|
|
|
|
$( '#but_submit' ).click () ->
|
|
hp = CryptoJS.SHA3 $( '#password' ).val(),
|
|
outputLength: 512
|
|
data =
|
|
username: $( '#username' ).val()
|
|
password: hp.toString()
|
|
$.post( '/login', data )
|
|
.done ( data ) ->
|
|
window.location.href = document.URL
|
|
.fail ( err ) ->
|
|
alert 'Authentication not successful!'
|
|
|
|
window.addEventListener 'load', fOnLoad, true
|