From 07fdd0a9d46e06cd3987aed85dcca51095c471dd Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 14 Feb 2020 07:31:22 +0000 Subject: [PATCH] Lowercase email on submisison --- webclient/src/Account.js | 3 ++- webclient/src/Admin.js | 3 ++- webclient/src/LoginSignup.js | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/webclient/src/Account.js b/webclient/src/Account.js index ce0a62b..9c4c4d1 100644 --- a/webclient/src/Account.js +++ b/webclient/src/Account.js @@ -126,7 +126,8 @@ export function AccountForm(props) { const handleSubmit = (e) => { if (loading) return; setLoading(true); - requester('/members/' + member.id + '/', 'PATCH', token, input) + const data = { ...input, email: input.email.toLowerCase() }; + requester('/members/' + member.id + '/', 'PATCH', token, data) .then(res => { setError({}); refreshUser(); diff --git a/webclient/src/Admin.js b/webclient/src/Admin.js index 6e15c2c..0fc8bc3 100644 --- a/webclient/src/Admin.js +++ b/webclient/src/Admin.js @@ -413,7 +413,8 @@ export function AdminMemberForm(props) { if (loading) return; setLoading(true); setSuccess(false); - requester('/members/' + id + '/', 'PATCH', token, input) + const data = { ...input, email: input.email.toLowerCase() }; + requester('/members/' + id + '/', 'PATCH', token, data) .then(res => { setLoading(false); setSuccess(true); diff --git a/webclient/src/LoginSignup.js b/webclient/src/LoginSignup.js index 3057bdf..d526b69 100644 --- a/webclient/src/LoginSignup.js +++ b/webclient/src/LoginSignup.js @@ -54,7 +54,7 @@ export function LoginForm(props) { }; export function SignupForm(props) { - const [input, setInput] = useState({}); + const [input, setInput] = useState({ email: '' }); const [error, setError] = useState({}); const [loading, setLoading] = useState(false); @@ -72,7 +72,8 @@ export function SignupForm(props) { if (loading) return; setLoading(true); input.username = genUsername(); - requester('/registration/', 'POST', '', input) + const data = { ...input, email: input.email.toLowerCase() }; + requester('/registration/', 'POST', '', data) .then(res => { setError({}); props.setTokenCache(res.key);