Uppercase the auth factor token in input value to match the email casing. (#7094)

This commit is contained in:
Brad Estey
2024-12-13 12:14:31 -05:00
committed by GitHub
parent add7a91d54
commit 5655241bef
+10
View File
@@ -60,6 +60,8 @@ export const LoginForm = ({
const [isProcessing, setIsProcessing] = useState<boolean>(false) const [isProcessing, setIsProcessing] = useState<boolean>(false)
const [isAuthFactorTokenNeeded, setIsAuthFactorTokenNeeded] = const [isAuthFactorTokenNeeded, setIsAuthFactorTokenNeeded] =
useState<boolean>(false) useState<boolean>(false)
const [isAuthFactorTokenValueEmpty, setIsAuthFactorTokenValueEmpty] =
useState<boolean>(true)
const identifierValueRef = useRef<string>(initialHandle || '') const identifierValueRef = useRef<string>(initialHandle || '')
const passwordValueRef = useRef<string>('') const passwordValueRef = useRef<string>('')
const authFactorTokenValueRef = useRef<string>('') const authFactorTokenValueRef = useRef<string>('')
@@ -262,6 +264,7 @@ export const LoginForm = ({
textContentType="username" textContentType="username"
blurOnSubmit={false} // prevents flickering due to onSubmitEditing going to next field blurOnSubmit={false} // prevents flickering due to onSubmitEditing going to next field
onChangeText={v => { onChangeText={v => {
setIsAuthFactorTokenValueEmpty(v === '')
authFactorTokenValueRef.current = v authFactorTokenValueRef.current = v
}} }}
onSubmitEditing={onPressNext} onSubmitEditing={onPressNext}
@@ -269,6 +272,13 @@ export const LoginForm = ({
accessibilityHint={_( accessibilityHint={_(
msg`Input the code which has been emailed to you`, msg`Input the code which has been emailed to you`,
)} )}
style={[
{
textTransform: isAuthFactorTokenValueEmpty
? 'none'
: 'uppercase',
},
]}
/> />
</TextField.Root> </TextField.Root>
<Text style={[a.text_sm, t.atoms.text_contrast_medium, a.mt_sm]}> <Text style={[a.text_sm, t.atoms.text_contrast_medium, a.mt_sm]}>