From 08474dbe14c8de3e4fc02931c9bb30fe344f9d94 Mon Sep 17 00:00:00 2001 From: stackxp <170874486+stackxp@users.noreply.github.com> Date: Sun, 14 Dec 2025 21:05:22 +0100 Subject: [PATCH] reject blank password in login ui (#1105) inlines css in msg.html to remove a roundtrip; response now requires multiple tcp-packets but probably always did realistically (https) Co-authored-by: stackxp Co-authored-by: ed --- copyparty/__init__.py | 1 - copyparty/web/msg.css | 36 ------------------------------------ copyparty/web/msg.html | 9 +++++++-- copyparty/web/splash.html | 2 ++ copyparty/web/splash.js | 13 ++++++++++++- scripts/sfx.ls | 1 - 6 files changed, 21 insertions(+), 41 deletions(-) delete mode 100644 copyparty/web/msg.css diff --git a/copyparty/__init__.py b/copyparty/__init__.py index 6baaaf5f..8dba6457 100644 --- a/copyparty/__init__.py +++ b/copyparty/__init__.py @@ -86,7 +86,6 @@ web/md2.js web/mde.css web/mde.html web/mde.js -web/msg.css web/msg.html web/opds.xml web/rups.css diff --git a/copyparty/web/msg.css b/copyparty/web/msg.css deleted file mode 100644 index ab8fa4d1..00000000 --- a/copyparty/web/msg.css +++ /dev/null @@ -1,36 +0,0 @@ -:root { - --font-main: sans-serif; - --font-serif: serif; - --font-mono: 'scp'; -} -html,body,tr,th,td,#files,a { - color: inherit; - background: none; - font-weight: inherit; - font-size: inherit; - padding: 0; - border: none; -} -html { - color: #ccc; - background: #333; - font-family: sans-serif; - font-family: var(--font-main), sans-serif; - text-shadow: 1px 1px 0px #000; - touch-action: manipulation; -} -html, body { - margin: 0; - padding: 0; -} -#box { - padding: .5em 1em; - background: #2c2c2c; -} -pre { - font-family: monospace, monospace; - font-family: var(--font-mono), monospace, monospace; -} -a { - color: #fc5; -} diff --git a/copyparty/web/msg.html b/copyparty/web/msg.html index cfae5828..f5d3edc9 100644 --- a/copyparty/web/msg.html +++ b/copyparty/web/msg.html @@ -7,7 +7,12 @@ - + {{ html_head }} @@ -43,7 +48,7 @@ {%- endif %} {%- if js %} diff --git a/copyparty/web/splash.html b/copyparty/web/splash.html index 9b642b9b..b57ff3f7 100644 --- a/copyparty/web/splash.html +++ b/copyparty/web/splash.html @@ -117,6 +117,7 @@ {%- if ahttps %} switch to https {%- endif %} +
{%- else %} @@ -149,6 +150,7 @@ {%- if ahttps %} switch to https {%- endif %} +
{%- endif %} diff --git a/copyparty/web/splash.js b/copyparty/web/splash.js index 6185f341..09d4694a 100644 --- a/copyparty/web/splash.js +++ b/copyparty/web/splash.js @@ -8,6 +8,8 @@ Ls.eng = { "ta1": "fill in your new password first", "ta2": "repeat to confirm new password:", "ta3": "found a typo; please try again", + "nop": "ERROR: Password cannot be blank", + "nou": "ERROR: Username and/or password cannot be blank", } }; @@ -95,8 +97,17 @@ if (/\&re=/.test('' + location)) ebi('x').onclick = function (e) { ev(e); if (!pwi.value) - return redo(d.ta1); + return ebi('lm').innerHTML = d.ta1; modal.prompt(d.ta2, "y", mok, null, stars); }; })(); + +if (ebi('lf')) + ebi('lf').onsubmit = function() { + var un = ebi('lu'); + if (ebi('lp').value && (!un || un.value)) + return true; + ebi('lm').innerHTML = un ? d.nou : d.nop; + return false; + }; diff --git a/scripts/sfx.ls b/scripts/sfx.ls index 59a13916..e387844a 100644 --- a/scripts/sfx.ls +++ b/scripts/sfx.ls @@ -99,7 +99,6 @@ copyparty/web/md2.js, copyparty/web/mde.css, copyparty/web/mde.html, copyparty/web/mde.js, -copyparty/web/msg.css, copyparty/web/msg.html, copyparty/web/opds.xml, copyparty/web/rups.css,