Display a message after successful submission of registration form
This commit is contained in:
parent
4d576b07da
commit
054e1c6da0
@ -11,6 +11,7 @@ import { register } from '@/app/api/authentication';
|
|||||||
import { getCaptchaChallenge } from '@/app/api/captcha';
|
import { getCaptchaChallenge } from '@/app/api/captcha';
|
||||||
|
|
||||||
export default function RegistrationForm() {
|
export default function RegistrationForm() {
|
||||||
|
const [submitted, setSubmitted] = useState<boolean>(false);
|
||||||
const [errors, setErrors] = useState<string[]>([]);
|
const [errors, setErrors] = useState<string[]>([]);
|
||||||
|
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
@ -36,6 +37,12 @@ export default function RegistrationForm() {
|
|||||||
useEffect(refreshCaptcha, [])
|
useEffect(refreshCaptcha, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
submitted ? (
|
||||||
|
<div className="card flex justify-evenly py-5 flex-col">
|
||||||
|
<div className="text-green-500">Registration successful. Check your email for a confirmation link.</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
|
||||||
<div className="card flex justify-evenly py-5 flex-col">
|
<div className="card flex justify-evenly py-5 flex-col">
|
||||||
<FloatLabel className="my-4">
|
<FloatLabel className="my-4">
|
||||||
<InputText id="email" type="email" className='rounded-sm' onChange={(e) => setEmail(e.target.value)} />
|
<InputText id="email" type="email" className='rounded-sm' onChange={(e) => setEmail(e.target.value)} />
|
||||||
@ -77,7 +84,7 @@ export default function RegistrationForm() {
|
|||||||
id: captchaId,
|
id: captchaId,
|
||||||
answer: captchaAnswer
|
answer: captchaAnswer
|
||||||
},
|
},
|
||||||
onRegister: () => { setErrors([]) },
|
onRegister: () => { setErrors([]); setSubmitted(true) },
|
||||||
onError: (errors) => { refreshCaptcha(); setErrors(errors) }
|
onError: (errors) => { refreshCaptcha(); setErrors(errors) }
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
@ -85,5 +92,7 @@ export default function RegistrationForm() {
|
|||||||
Register
|
Register
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user