Lowercase email on submisison

This commit is contained in:
Tanner Collin 2020-02-14 07:31:22 +00:00
parent 8c630ada1f
commit 07fdd0a9d4
3 changed files with 7 additions and 4 deletions

View File

@ -126,7 +126,8 @@ export function AccountForm(props) {
const handleSubmit = (e) => { const handleSubmit = (e) => {
if (loading) return; if (loading) return;
setLoading(true); 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 => { .then(res => {
setError({}); setError({});
refreshUser(); refreshUser();

View File

@ -413,7 +413,8 @@ export function AdminMemberForm(props) {
if (loading) return; if (loading) return;
setLoading(true); setLoading(true);
setSuccess(false); setSuccess(false);
requester('/members/' + id + '/', 'PATCH', token, input) const data = { ...input, email: input.email.toLowerCase() };
requester('/members/' + id + '/', 'PATCH', token, data)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
setSuccess(true); setSuccess(true);

View File

@ -54,7 +54,7 @@ export function LoginForm(props) {
}; };
export function SignupForm(props) { export function SignupForm(props) {
const [input, setInput] = useState({}); const [input, setInput] = useState({ email: '' });
const [error, setError] = useState({}); const [error, setError] = useState({});
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
@ -72,7 +72,8 @@ export function SignupForm(props) {
if (loading) return; if (loading) return;
setLoading(true); setLoading(true);
input.username = genUsername(); input.username = genUsername();
requester('/registration/', 'POST', '', input) const data = { ...input, email: input.email.toLowerCase() };
requester('/registration/', 'POST', '', data)
.then(res => { .then(res => {
setError({}); setError({});
props.setTokenCache(res.key); props.setTokenCache(res.key);