summaryrefslogtreecommitdiff
path: root/static/js/fullscreenphotobooth.js
diff options
context:
space:
mode:
authoryo momma <shutup@oops.wtf>2026-01-27 03:33:16 +0000
committeryo momma <shutup@oops.wtf>2026-01-27 03:33:16 +0000
commitfc9a4ea22eb91757b95cbe1bf1708be17fc2337a (patch)
tree76a0122149e3288ee21d7fb6d0410b1b7b8970a4 /static/js/fullscreenphotobooth.js
parent25b74138d68ade87689e714f10e1f3116da5bbee (diff)
Fix HTTPS/mixed content; make config env-drivenHEADmaster2026
- 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/fullscreenphotobooth.js')
-rwxr-xr-xstatic/js/fullscreenphotobooth.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/static/js/fullscreenphotobooth.js b/static/js/fullscreenphotobooth.js
index 29795ee..2bbbbb5 100755
--- a/static/js/fullscreenphotobooth.js
+++ b/static/js/fullscreenphotobooth.js
@@ -103,6 +103,21 @@ function initLogin() {
'2px solid #30009b');
}
+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('');
@@ -115,9 +130,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') {
@@ -131,7 +146,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({
@@ -182,4 +197,4 @@ $(function() {
$('#memelogo').stop(true, false).animate({opacity: 1.0}, "fast").delay(LogoFadeDelay).animate({opacity: 0}, "slow");
});
$('#memelogo').delay(LogoFadeDelay).animate({opacity: 0}, "slow");
-}); \ No newline at end of file
+});