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) => {
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();

View File

@ -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);

View File

@ -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);