Changeset View
Changeset View
Standalone View
Standalone View
web/account/log-in-form.react.js
Show First 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | (event: SyntheticEvent<HTMLElement>) => { | ||||
setErrorMessage('usernames only, not emails'); | setErrorMessage('usernames only, not emails'); | ||||
usernameInputRef.current?.focus(); | usernameInputRef.current?.focus(); | ||||
return; | return; | ||||
} else if (username.search(oldValidUsernameRegex) === -1) { | } else if (username.search(oldValidUsernameRegex) === -1) { | ||||
setUsername(''); | setUsername(''); | ||||
setErrorMessage('alphanumeric usernames only'); | setErrorMessage('alphanumeric usernames only'); | ||||
usernameInputRef.current?.focus(); | usernameInputRef.current?.focus(); | ||||
return; | return; | ||||
} else if (password === '') { | |||||
setErrorMessage('password is empty'); | |||||
usernameInputRef.current?.focus(); | |||||
return; | |||||
} | } | ||||
const extraInfo = loginExtraInfo(); | const extraInfo = loginExtraInfo(); | ||||
dispatchActionPromise( | dispatchActionPromise( | ||||
logInActionTypes, | logInActionTypes, | ||||
logInAction(extraInfo), | logInAction(extraInfo), | ||||
undefined, | undefined, | ||||
({ calendarQuery: extraInfo.calendarQuery }: LogInStartingPayload), | ({ calendarQuery: extraInfo.calendarQuery }: LogInStartingPayload), | ||||
); | ); | ||||
}, | }, | ||||
[dispatchActionPromise, logInAction, loginExtraInfo, username], | [dispatchActionPromise, logInAction, loginExtraInfo, username, password], | ||||
); | ); | ||||
const loginButtonContent = React.useMemo(() => { | const loginButtonContent = React.useMemo(() => { | ||||
if (inputDisabled) { | if (inputDisabled) { | ||||
return <LoadingIndicator status="loading" />; | return <LoadingIndicator status="loading" />; | ||||
} | } | ||||
return 'Log in'; | return 'Log in'; | ||||
}, [inputDisabled]); | }, [inputDisabled]); | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |