feat(frontend): handle username in lowercase

When handling usernames for login and registering with local or permissions, this makes sure that the username is always in lowercase.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Philip Molares 2023-05-21 21:59:46 +02:00 committed by Tilman Vatteroth
parent 0a8945d934
commit e13055736a
9 changed files with 95 additions and 15 deletions

View file

@ -17,6 +17,7 @@ import { useUiNotifications } from '../components/notifications/ui-notification-
import { RegisterError } from '../components/register-page/register-error'
import { RegisterInfos } from '../components/register-page/register-infos'
import { useApplicationState } from '../hooks/common/use-application-state'
import { useLowercaseOnInputChange } from '../hooks/common/use-lowercase-on-input-change'
import { useOnInputChange } from '../hooks/common/use-on-input-change'
import type { NextPage } from 'next'
import { useRouter } from 'next/router'
@ -62,7 +63,7 @@ export const RegisterPage: NextPage = () => {
return error?.backendErrorName === 'PasswordTooWeakError'
}, [error])
const onUsernameChange = useOnInputChange(setUsername)
const onUsernameChange = useLowercaseOnInputChange(setUsername)
const onDisplayNameChange = useOnInputChange(setDisplayName)
const onPasswordChange = useOnInputChange(setPassword)
const onPasswordAgainChange = useOnInputChange(setPasswordAgain)