diff options
| author | sostler <sbostler@gmail.com> | 2009-12-06 20:38:51 -0500 |
|---|---|---|
| committer | sostler <sbostler@gmail.com> | 2009-12-06 20:38:51 -0500 |
| commit | 631f492c328ee40414ee32f717215d3fdda6f55a (patch) | |
| tree | ad3c4e284b06c3ddc4fd2eb9ac6ea6280f7c07ac /static/home.js | |
| parent | 9dd2ee1b1eb63529f5694d2e400dd04cc1eb1663 (diff) | |
Profiles / templates
Diffstat (limited to 'static/home.js')
| -rwxr-xr-x | static/home.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/static/home.js b/static/home.js new file mode 100755 index 0000000..5857368 --- /dev/null +++ b/static/home.js @@ -0,0 +1,35 @@ +function ifEnter(fn) { + return function(e) { + if (e.keyCode == 13) { fn(); } + }; +} + +function initHome() { + $('#passwordInput').keyup(ifEnter(login)); + $('#loginSubmit').click(login); +} + +function login() { + var nick = $('#nickInput').val(); + var password = $('#passwordInput').val(); + var hash = hex_sha1(nick + '$' + password + '$dumpfm'); + + var onSuccess = function(json) { + location.href = "u/" + nick; + }; + + var onError = function(resp, textStatus, errorThrown) { + alert("Error logging in!"); + }; + + $.ajax({ + type: 'GET', + timeout: 5000, + url: 'login', + data: {'nick': nick, ts: '', 'hash': hash }, + cache: false, + dataType: 'json', + success: onSuccess, + error: onError + }); +};
\ No newline at end of file |
