Skip to content

Commit

Permalink
chore(a11y): TwoFactor (#6048)
Browse files Browse the repository at this point in the history
  • Loading branch information
OtavioStasiak authored Jan 8, 2025
1 parent c53627a commit bd3558e
Show file tree
Hide file tree
Showing 27 changed files with 106 additions and 34 deletions.
2 changes: 1 addition & 1 deletion app/containers/TextInput/FormTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const FormTextInput = ({
return (
<View
accessible
accessibilityLabel={`${label} - ${required ? i18n.t('Required') : ''}`}
accessibilityLabel={accessibilityLabel ?? `${label} - ${required ? i18n.t('Required') : ''}`}
style={[styles.inputContainer, containerStyle]}>
{label ? (
<Text style={[styles.label, { color: colors.fontTitlesLabels }, error?.error && { color: colors.fontDanger }]}>
Expand Down
24 changes: 18 additions & 6 deletions app/containers/TwoFactor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const TwoFactor = React.memo(() => {
}
}
} catch (e) {
log(e)
log(e);
}
};

Expand All @@ -93,7 +93,9 @@ const TwoFactor = React.memo(() => {
}
}, [data]);

const showTwoFactor = (args: EventListenerMethod) => setData(args);
const showTwoFactor = (args: EventListenerMethod) => {
setData(args);
};

useEffect(() => {
const listener = EventEmitter.addEventListener(TWO_FACTOR, showTwoFactor);
Expand Down Expand Up @@ -123,7 +125,12 @@ const TwoFactor = React.memo(() => {

const color = colors.fontTitlesLabels;
return (
<Modal avoidKeyboard useNativeDriver isVisible={visible} hideModalContentWhileAnimating>
<Modal
customBackdrop={<View aria-hidden style={[styles.overlay, { backgroundColor: colors.overlayBackground }]} />}
avoidKeyboard
useNativeDriver
isVisible={visible}
hideModalContentWhileAnimating>
<View style={styles.container} testID='two-factor'>
<View
style={[
Expand All @@ -134,17 +141,22 @@ const TwoFactor = React.memo(() => {
<Text style={[styles.title, { color }]}>{I18n.t(method?.title || 'Two_Factor_Authentication')}</Text>
{method?.text ? <Text style={[styles.subtitle, { color }]}>{I18n.t(method.text)}</Text> : null}
<FormTextInput
value={code}
inputRef={(e: any) => InteractionManager.runAfterInteractions(() => e?.getNativeRef()?.focus())}
returnKeyType='send'
autoCapitalize='none'
testID='two-factor-input'
accessibilityLabel={I18n.t(
data?.method === 'password' ? 'Label_Input_Two_Factor_Password' : 'Label_Input_Two_Factor_Code'
)}
value={code}
inputRef={(e: any) => InteractionManager.runAfterInteractions(() => e?.getNativeRef()?.focus())}
onChangeText={setCode}
onSubmitEditing={onSubmit}
keyboardType={method?.keyboardType}
secureTextEntry={method?.secureTextEntry}
error={data.invalid ? { error: 'totp-invalid', reason: I18n.t('Code_or_password_invalid') } : undefined}
testID='two-factor-input'
containerStyle={styles.containerInput}
/>

{isEmail ? (
<Button
small
Expand Down
18 changes: 14 additions & 4 deletions app/containers/TwoFactor/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
padding: 16
},
content: {
padding: 16,
Expand All @@ -15,13 +15,14 @@ export default StyleSheet.create({
},
title: {
fontSize: 16,
paddingBottom: 8,
lineHeight: 24,
marginBottom: 12,
...sharedStyles.textBold,
...sharedStyles.textAlignCenter
},
subtitle: {
fontSize: 14,
paddingBottom: 8,
marginBottom: 12,
...sharedStyles.textRegular,
...sharedStyles.textAlignCenter
},
Expand All @@ -37,9 +38,18 @@ export default StyleSheet.create({
},
buttonContainer: {
flexDirection: 'row',
justifyContent: 'space-between'
justifyContent: 'space-between',
marginTop: 36
},
tablet: {
height: undefined
},
overlay: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
},
containerInput: {
marginBottom: 0
}
});
4 changes: 3 additions & 1 deletion app/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"Files": "ملفات",
"Finish_recording": "إنهاء التسجيل",
"Following_thread": "متابعة الموضوع",
"For_your_security_you_must_enter_your_current_password_to_continue": "من أجل حمايتك، يجب عليك إدخال كلمة المرور الحالية للمتابعة",
"For_your_security_you_must_enter_your_current_password_to_continue": "لأمانك، يجب عليك إدخال كلمة مرور حسابك للمتابعة.",
"Forgot_password": "هل نسيت كلمة المرور؟",
"Forgot_password_If_this_email_is_registered": "إن كان البريد الإلكتروني مسجلاً، فسنرسل تعليمات إعادة تعيين كلمة المرور الخاصة بك. إذا لم تتلق بريداً إلكترونياً قريباً، فيرجى العودة والمحاولة مرة أخرى",
"Forward": "إعادة توجيه",
Expand Down Expand Up @@ -197,6 +197,8 @@
"Join_the_given_channel": "انضمام إلى القناة المحددة",
"Just_invited_people_can_access_this_channel": "يمكن للأشخاص المدعوين فقط الوصول إلى هذه القناة",
"Just_invited_people_can_access_this_team": "فقط الأشخاص المدعوين يمكنهم الوصول إلى هذا الفريق",
"Label_Input_Two_Factor_Code": "كود",
"Label_Input_Two_Factor_Password": "كلمة المرور",
"Language": "اللغة",
"last_message": "الرسالة الأخيرة",
"Leave": "مغادرة الغرفة",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/bn-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
"Finish_recording": "রেকর্ডিং শেষ করুন",
"Following": "অনুসরণ",
"Following_thread": "থ্রেড অনুসরণ করছেন",
"For_your_security_you_must_enter_your_current_password_to_continue": "আপনার নিরাপত্তার জন্য, আপনার বর্তমান পাসওয়ার্ড দিতে হবে যাতে আপনি চালিয়ে যান",
"For_your_security_you_must_enter_your_current_password_to_continue": "আপনার নিরাপত্তার জন্য, চালিয়ে যেতে হলে আপনাকে আপনার অ্যাকাউন্টের পাসওয়ার্ড প্রবেশ করতে হবে।",
"Forgot_password": "আপনার পাসওয়ার্ড ভুলে গিয়েছেন?",
"Forgot_password_If_this_email_is_registered": "যদি এই ইমেইলটি নিবন্ধিত হয়ে থাকে, আমরা আপনাকে কীভাবে আপনার পাসওয়ার্ড রিসেট করতে হয় তা সম্পর্কে নির্দেশনা প্রেরণ করব। যদি আপনি শীঘ্রই একটি ইমেইল পাননি, তবে অনুগ্রহ করে ফিরে আসুন এবং আবার চেষ্টা করুন।",
"Forward": "ফরোয়ার্ড",
Expand Down Expand Up @@ -316,6 +316,8 @@
"Joined": "যোগদান করেছে",
"Just_invited_people_can_access_this_channel": "এই চ্যানেলে শুধুমাত্র আমন্ত্রিত ব্যক্তিদের অ্যাক্সেস করতে পারবে",
"Just_invited_people_can_access_this_team": "এই দলে শুধুমাত্র আমন্ত্রিত ব্যক্তিদের অ্যাক্সেস করতে পারবে",
"Label_Input_Two_Factor_Code": "কোড",
"Label_Input_Two_Factor_Password": "পাসওয়ার্ড",
"Language": "ভাষা",
"last_message": "শেষ বার্তা",
"Last_owner_team_room": "আপনি এই চ্যানেলের শেষ মালিক। একবার দল থেকে বের হওয়ার পরে, চ্যানেলটি দলের মধ্যে থাকবে কিন্তু আপনি তাকে বাইরে থেকে পরিচালনা করবেন।",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
"Finish_recording": "Dokončit nahrávání",
"Following": "Následující",
"Following_thread": "Následující vlákno",
"For_your_security_you_must_enter_your_current_password_to_continue": "Pro vaši bezpečnost musíte pro pokračování zadat své aktuální heslo",
"For_your_security_you_must_enter_your_current_password_to_continue": "Pro vaši bezpečnost musíte zadat heslo k účtu, abyste mohli pokračovat.",
"Forgot_password": "Zapomněli jste heslo?",
"Forgot_password_If_this_email_is_registered": "Pokud je tento e-mail zaregistrován, zašleme Vám pokyny, jak obnovit heslo. Pokud e-mail v nejbližší době neobdržíte, vraťte se a zkuste to znovu.",
"Forward": "Vpřed",
Expand Down Expand Up @@ -346,6 +346,8 @@
"Jump_to_message": "Přejít na zprávu",
"Just_invited_people_can_access_this_channel": "K tomuto kanálu mají přístup pouze pozvaní lidé",
"Just_invited_people_can_access_this_team": "K tomuto týmu mají přístup pouze pozvaní lidé",
"Label_Input_Two_Factor_Code": "Kód",
"Label_Input_Two_Factor_Password": "Heslo",
"Language": "Jazyk",
"last_message": "poslední zpráva",
"Last_owner_team_room": "Jste posledním vlastníkem tohoto kanálu. Jakmile tým opustíte, kanál zůstane uvnitř týmu, ale budete ho spravovat zvenčí.",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
"Finish_recording": "Aufnahme neenden",
"Following": "verfolgte",
"Following_thread": "Thread folgen",
"For_your_security_you_must_enter_your_current_password_to_continue": "Zu Ihrer Sicherheit müssen Sie Ihr aktuelles Passwort eingeben, um fortzufahren",
"For_your_security_you_must_enter_your_current_password_to_continue": "Zu Ihrer Sicherheit müssen Sie Ihr Kontopasswort eingeben, um fortzufahren.",
"Forgot_password": "Passwort vergessen",
"Forgot_password_If_this_email_is_registered": "Wenn es sich um eine registrierte E-Mail-Adresse handelt, werden wir an diese eine Anleitung zum Zurücksetzen des Passworts senden. Sollten Sie in Kürzen keine E-Mail erhalten, kommen Sie wieder und versuchen Sie es noch einmal.",
"Forward": "Weiterleiten",
Expand Down Expand Up @@ -309,6 +309,8 @@
"Joined": "Beigetreten",
"Just_invited_people_can_access_this_channel": "Nur eingeladene Personen können auf diesen Kanal zugreifen",
"Just_invited_people_can_access_this_team": "Nur eingeladene Personen können auf das Team zugreifen",
"Label_Input_Two_Factor_Code": "Code",
"Label_Input_Two_Factor_Password": "Passwort",
"Language": "Sprache",
"last_message": "letzte Nachricht",
"Last_owner_team_room": "Sie sind der letzte Eigner dieses Channels. Wenn Sie das Team verlassen haben, bleibt der Channel im Team, aber Sie werden ihn von außen verwalten.",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
"Finish_recording": "Finish recording",
"Following": "Following",
"Following_thread": "Following thread",
"For_your_security_you_must_enter_your_current_password_to_continue": "For your security, you must enter your current password to continue",
"For_your_security_you_must_enter_your_current_password_to_continue": "For your security, you must enter your account password to continue.",
"Forgot_password": "Forgot your password?",
"Forgot_password_If_this_email_is_registered": "If this email is registered, we'll send instructions on how to reset your password. If you do not receive an email shortly, please come back and try again.",
"Forward": "Forward",
Expand Down Expand Up @@ -367,6 +367,8 @@
"Jump_to_message": "Jump to message",
"Just_invited_people_can_access_this_channel": "Just invited people can access this channel",
"Just_invited_people_can_access_this_team": "Just invited people can access this team",
"Label_Input_Two_Factor_Code": "Code",
"Label_Input_Two_Factor_Password": "Password",
"Language": "Language",
"last_message": "last message",
"Last_owner_team_room": "You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"Files": "Archivos",
"Finish_recording": "Finalizar grabación",
"Following_thread": "Siguiendo hilo",
"For_your_security_you_must_enter_your_current_password_to_continue": "Por seguridad, debes introducir tu contraseña para continuar",
"For_your_security_you_must_enter_your_current_password_to_continue": "Por su seguridad, debe ingresar la contraseña de su cuenta para continuar.",
"Forgot_password": "¿Ha olvidado su contraseña?",
"Forgot_password_If_this_email_is_registered": "Si este email está registrado, te enviaremos las instrucciones para resetear tu contraseña. Si no recibes un email en breve, vuelve aquí e inténtalo de nuevo.",
"Full_name": "Nombre completo",
Expand All @@ -131,6 +131,8 @@
"Join": "Conectar",
"Join_the_given_channel": "Unirse al canal dado",
"Just_invited_people_can_access_this_channel": "Sólo gente invitada puede acceder a este canal.",
"Label_Input_Two_Factor_Code": "Código",
"Label_Input_Two_Factor_Password": "Contraseña",
"Language": "Idioma",
"last_message": "último mensaje",
"Learn_more": "Saber más",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
"Finish_recording": "Lopeta tallennus",
"Following": "Seurataan",
"Following_thread": "Seurataan ketjua",
"For_your_security_you_must_enter_your_current_password_to_continue": "Jatka antamalla nykyinen salasanasi turvallisuussyistä",
"For_your_security_you_must_enter_your_current_password_to_continue": "Turvallisuutesi vuoksi sinun on syötettävä tilisi salasana jatkaaksesi.",
"Forgot_password": "Unohditko salasanasi?",
"Forgot_password_If_this_email_is_registered": "Jos tämä sähköpostiosoite on rekisteröity, lähetämme salasanan nollausohjeet. Jos et saa sähköpostia pian, palaa ja yritä uudelleen.",
"Forward": "Välitä",
Expand Down Expand Up @@ -291,6 +291,8 @@
"Joined": "Liitytty",
"Just_invited_people_can_access_this_channel": "Vain kutsutut ihmiset voivat käyttää tätä kanavaa",
"Just_invited_people_can_access_this_team": "Vain kutsutut ihmiset voivat käyttää tätä tiimiä",
"Label_Input_Two_Factor_Code": "Koodi",
"Label_Input_Two_Factor_Password": "Salasana",
"Language": "Kieli",
"last_message": "viimeinen viesti",
"Last_owner_team_room": "Olet tämän kanavan viimeinen omistaja. Kun lähdet tiimistä, kanava säilyy tiimin sisällä, mutta hallinnoit sitä ulkopuolelta.",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
"Finish_recording": "Terminer l'enregistrement",
"Following": "Suivant",
"Following_thread": "Suivre le fil",
"For_your_security_you_must_enter_your_current_password_to_continue": "Pour votre sécurité, vous devez entrer votre mot de passe actuel pour continuer.",
"For_your_security_you_must_enter_your_current_password_to_continue": "Pour votre sécurité, vous devez entrer le mot de passe de votre compte pour continuer.",
"Forgot_password": "Mot de passe oublié ?",
"Forgot_password_If_this_email_is_registered": "Si cet e-mail est enregistré, nous vous enverrons des instructions pour réinitialiser votre mot de passe. Si vous ne recevez pas d'e-mail sous peu, veuillez revenir et réessayer.",
"Forward": "Transmettre",
Expand Down Expand Up @@ -254,6 +254,8 @@
"Join_the_given_channel": "Rejoindre le canal indiqué",
"Just_invited_people_can_access_this_channel": "Seuls les personnes invitées peuvent accéder à ce canal",
"Just_invited_people_can_access_this_team": "Seules les personnes invitées peuvent accéder à cette équipe",
"Label_Input_Two_Factor_Code": "Code",
"Label_Input_Two_Factor_Password": "Mot de passe",
"Language": "Langue",
"last_message": "dernier message",
"Last_owner_team_room": "Vous êtes le dernier propriétaire de ce canal. Une fois que vous quittez l'équipe, le canal sera conservé au sein de l'équipe mais vous le gérerez de l'extérieur.",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/hi-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
"Finish_recording": "रेकॉर्डिंग समाप्त करें",
"Following": "फॉलो कर रहा है",
"Following_thread": "निरंतर थ्रेड",
"For_your_security_you_must_enter_your_current_password_to_continue": "आपकी सुरक्षा के लिए, आपको जारी रखने के लिए अपना वर्तमान पासवर्ड दर्ज करना होगा",
"For_your_security_you_must_enter_your_current_password_to_continue": "आपकी सुरक्षा के लिए, जारी रखने के लिए आपको अपने खाते का पासवर्ड दर्ज करना होगा",
"Forgot_password": "पासवर्ड भूल गए हैं?",
"Forgot_password_If_this_email_is_registered": "यदि यह ईमेल पंजीकृत है, तो हम आपको पासवर्ड रीसेट करने के लिए निर्देश भेजेंगे। यदि आपको शीघ्रता से एक ईमेल प्राप्त नहीं होता है, तो कृपया वापस आकर पुनः प्रयास करें।",
"Forward": "आगे बढ़ें",
Expand Down Expand Up @@ -316,6 +316,8 @@
"Joined": "शामिल हो गए",
"Just_invited_people_can_access_this_channel": "केवल निमंत्रित लोग इस चैनल तक पहुंच सकते हैं",
"Just_invited_people_can_access_this_team": "केवल निमंत्रित लोग इस टीम तक पहुंच सकते हैं",
"Label_Input_Two_Factor_Code": "कोड",
"Label_Input_Two_Factor_Password": "पासवर्ड",
"Language": "भाषा",
"last_message": "आखिरी संदेश",
"Last_owner_team_room": "आप इस चैनल के आखिरी मालिक हैं। जब आप टीम छोड़ेंगे, चैनल को टीम के अंदर रखा जाएगा, लेकिन आप इसे बाहर से प्रबंधित करेंगे।",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
"Finish_recording": "Rögzítés befejezése",
"Following": "Követve",
"Following_thread": "Követett szál",
"For_your_security_you_must_enter_your_current_password_to_continue": "A biztonsága érdekében meg kell adnia a jelenlegi jelszavát a folytatáshoz",
"For_your_security_you_must_enter_your_current_password_to_continue": "A biztonsága érdekében meg kell adnia a fiókja jelszavát a folytatáshoz.",
"Forgot_password": "Elfelejtette a jelszavát?",
"Forgot_password_If_this_email_is_registered": "Ha ez az e-mail-cím regisztrálva van, akkor utasításokat küldünk a jelszó visszaállításához. Ha nem kap rövidesen e-mailt, akkor térjen vissza, és próbálja meg újra.",
"Forward": "Továbbítás",
Expand Down Expand Up @@ -317,6 +317,8 @@
"Jump_to_message": "Ugrás az üzenethez",
"Just_invited_people_can_access_this_channel": "Csak a meghívott személyek férhetnek hozzá ehhez a csatornához.",
"Just_invited_people_can_access_this_team": "Csak meghívott emberek férhetnek hozzá ehhez a csapathoz",
"Label_Input_Two_Factor_Code": "Kód",
"Label_Input_Two_Factor_Password": "Jelszó",
"Language": "Nyelv",
"last_message": "utolsó üzenet",
"Last_owner_team_room": "Ön az utolsó tulajdonosa ennek a csatornának. Ha elhagyja a csapatot, a csatorna a csapaton belül marad, de Ön kívülről fogja kezelni.",
Expand Down
4 changes: 3 additions & 1 deletion app/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
"Finish_recording": "Termina registrazione",
"Following": "Seguiti",
"Following_thread": "Thread seguito",
"For_your_security_you_must_enter_your_current_password_to_continue": "Per garantire la sicurezza del tuo account, inserisci la password per continuare.",
"For_your_security_you_must_enter_your_current_password_to_continue": "Per la tua sicurezza, devi inserire la password del tuo account per continuare.",
"Forgot_password": "Password dimenticata",
"Forgot_password_If_this_email_is_registered": "Se questa e-mail è registrata, manderemo istruzioni su come resettare la tua password. Se non ricevi nulla, torna qui e riprova di nuovo.",
"Forward": "Inoltra",
Expand Down Expand Up @@ -226,6 +226,8 @@
"Join_the_given_channel": "Entra nel canale specificato",
"Just_invited_people_can_access_this_channel": "Solo le persone invitate possono accedere a questo canale",
"Just_invited_people_can_access_this_team": "Solo le persone invitate possono accedere a questo team",
"Label_Input_Two_Factor_Code": "Codice",
"Label_Input_Two_Factor_Password": "Password",
"Language": "Lingua",
"last_message": "ultimo messaggio",
"Leave": "Lasciare il canale",
Expand Down
Loading

0 comments on commit bd3558e

Please sign in to comment.