babyproofing

This commit is contained in:
Julian 2023-04-25 21:15:55 -04:00
parent e01278e050
commit 9c65c76026
Signed by: NotNite
GPG Key ID: BD91A5402CCEB08A
1 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,7 @@ export default function RegisterForm({ ticket }: { ticket: string }) {
const passwordRef = React.useRef<HTMLInputElement>(null); const passwordRef = React.useRef<HTMLInputElement>(null);
const confirmPasswordRef = React.useRef<HTMLInputElement>(null); const confirmPasswordRef = React.useRef<HTMLInputElement>(null);
const avatarRef = React.useRef<HTMLInputElement>(null); const avatarRef = React.useRef<HTMLInputElement>(null);
const submitRef = React.useRef<HTMLInputElement>(null);
const [usernameTaken, setUsernameTaken] = React.useState(false); const [usernameTaken, setUsernameTaken] = React.useState(false);
const [passwordMismatch, setPasswordMismatch] = React.useState(false); const [passwordMismatch, setPasswordMismatch] = React.useState(false);
@ -64,6 +65,7 @@ export default function RegisterForm({ ticket }: { ticket: string }) {
<form <form
onSubmit={async (e) => { onSubmit={async (e) => {
e.preventDefault(); e.preventDefault();
submitRef.current!.disabled = true;
const [username, displayName, email, password, confirmPassword] = [ const [username, displayName, email, password, confirmPassword] = [
usernameRef, usernameRef,
@ -101,6 +103,7 @@ export default function RegisterForm({ ticket }: { ticket: string }) {
avatarBase64 avatarBase64
}) })
}); });
submitRef.current!.disabled = false;
if (req.status === 500) { if (req.status === 500) {
// something real bad fucked up // something real bad fucked up
@ -191,7 +194,7 @@ export default function RegisterForm({ ticket }: { ticket: string }) {
/> />
<div className={styles.buttonContainer}> <div className={styles.buttonContainer}>
<input type="submit" value="Join NotNet!" /> <input type="submit" value="Join NotNet!" ref={submitRef} />
</div> </div>
</form> </form>
</div> </div>