From c66a9851cc83cbe2564fd9307be54c559c0d9985 Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Sat, 21 Jan 2023 20:07:39 -0500 Subject: [PATCH] Re-add password confirmation --- server/server.go | 1 - web/src/components/Signup.js | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/server/server.go b/server/server.go index cceb7d8..4221653 100644 --- a/server/server.go +++ b/server/server.go @@ -41,7 +41,6 @@ TODO UAT results (round 1): - Security: Account re-creation leads to terrible behavior. Use user ID instead of user name for (a) visitor map, (b) messages.user column, (c) Stripe checkout session - Account: Changing password should confirm the old password (Thorben) -- Signup: Re-add password confirmation (Thorben & deadcade) - Reservation: Kill existing subscribers when topic is reserved (deadcade) - Reservation (UI): Show "This topic is reserved" error message when trying to reserve a reserved topic (Thorben) - Reservation (UI): Ask for confirmation when removing reservation (deadcade) diff --git a/web/src/components/Signup.js b/web/src/components/Signup.js index 9665bd4..c5cbaf0 100644 --- a/web/src/components/Signup.js +++ b/web/src/components/Signup.js @@ -20,7 +20,10 @@ const Signup = () => { const [error, setError] = useState(""); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); + const [confirm, setConfirm] = useState(""); const [showPassword, setShowPassword] = useState(false); + const [showConfirm, setShowConfirm] = useState(false); + const handleSubmit = async (event) => { event.preventDefault(); const user = { username, password }; @@ -43,6 +46,7 @@ const Signup = () => { } } }; + if (!config.enable_signup) { return ( @@ -50,6 +54,7 @@ const Signup = () => { ); } + return ( @@ -75,7 +80,7 @@ const Signup = () => { label={t("signup_form_password")} type={showPassword ? "text" : "password"} id="password" - autoComplete="current-password" + autoComplete="new-password" value={password} onChange={ev => setPassword(ev.target.value.trim())} InputProps={{ @@ -93,11 +98,37 @@ const Signup = () => { ) }} /> + setConfirm(ev.target.value.trim())} + InputProps={{ + endAdornment: ( + + setShowConfirm(!showConfirm)} + onMouseDown={(ev) => ev.preventDefault()} + edge="end" + > + {showConfirm ? : } + + + ) + }} + />