diff options
| author | yo momma <shutup@oops.wtf> | 2026-01-27 03:33:16 +0000 |
|---|---|---|
| committer | yo momma <shutup@oops.wtf> | 2026-01-27 03:33:16 +0000 |
| commit | fc9a4ea22eb91757b95cbe1bf1708be17fc2337a (patch) | |
| tree | 76a0122149e3288ee21d7fb6d0410b1b7b8970a4 /static/js/fullscreen.js | |
| parent | 25b74138d68ade87689e714f10e1f3116da5bbee (diff) | |
- Replace hardcoded dump.fm URLs with host/scheme config\n- Add optional passwordless login flow\n- Update templates/static assets to avoid blocked HTTP resources\n- Ignore local uploads/SQL dumps
Diffstat (limited to 'static/js/fullscreen.js')
| -rwxr-xr-x | static/js/fullscreen.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/static/js/fullscreen.js b/static/js/fullscreen.js index 17b0614..38e09ee 100755 --- a/static/js/fullscreen.js +++ b/static/js/fullscreen.js @@ -92,6 +92,21 @@ function initLogin() { ); } +function loginErrorText(resp) { + var code = ""; + try { + code = (resp && resp.responseText) ? ("" + resp.responseText).replace(/^\s+|\s+$/g, "") : ""; + } catch(e) {} + if (code == "NICK_TOO_SHORT") return "Username too short (min 3 characters)."; + if (code == "NICK_TOO_LONG") return "Username too long (max 16 characters)."; + if (code == "NICK_INVALID_CHARS") return "Username can only use letters, numbers, '_' and '-'."; + if (code == "NICK_TAKEN") return "That username is taken/reserved. Try another."; + if (code == "RECENTLY_CREATED") return "Too many new accounts from this IP. Try an existing username."; + if (code == "RECENTLY_MUTED") return "This IP is restricted from creating new accounts. Try an existing username."; + if (code && code != "BAD_LOGIN") return "Couldn't log you in (" + code + ")."; + return "Couldn't log you in :( Try a different username."; +} + function showLogin() { $('#nickInput').val(''); $('#passwordInput').val(''); @@ -104,9 +119,9 @@ function login() { $('#spinner').show(); $('input').attr('disabled', 'disabled'); var nick = $('#nickInput').val(); - var password = $('#passwordInput').val(); + var password = $('#passwordInput').val() || ''; var rememberme = $('#remembermeInput').attr('checked') ? 'yes' : ''; - var hash = hex_sha1(nick + '$' + password + '$dumpfm'); + var hash = password ? hex_sha1(nick + '$' + password + '$dumpfm') : ''; var onSuccess = function(json) { // if (typeof pageTracker !== 'undefined') { @@ -121,7 +136,7 @@ function login() { var onError = function(resp, textStatus, errorThrown) { $('#spinner').hide(); $('input').removeAttr('disabled'); - $('#errormsg').text("Couldn't log you in :( Bad password?"); + $('#errormsg').text(loginErrorText(resp)); } $.ajax({ @@ -507,4 +522,3 @@ function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } - |
