Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: remove recovery code input maxLength (#1922)

Ammar Ahmed56008c15c5b4
diff --git a/apps/mobile/app/components/auth/two-factor.js b/apps/mobile/app/components/auth/two-factor.js
index abee1e9e3..7bef92c4b 100644
--- a/apps/mobile/app/components/auth/two-factor.js
+++ b/apps/mobile/app/components/auth/two-factor.js
@@ -65,9 +65,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
};
const onNext = async () => {
- const length = currentMethod.method === "recoveryCode" ? 10 : 6;
-
- if (!code.current || code.current.length !== length) return;
+ if (!code.current || code.current.length < 6) return;
setLoading(true);
inputRef.current?.blur();
await onMfaLogin(
@@ -203,16 +201,16 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
<Input
placeholder={
currentMethod.method === "recoveryCode"
- ? "xxxxxxxxxx"
+ ? "xxxxx-xxxxx"
: "xxxxxx"
}
testID={"input.totp"}
- maxLength={currentMethod.method === "recoveryCode" ? 10 : 6}
+ maxLength={currentMethod.method === "recoveryCode" ? undefined : 6}
fwdRef={inputRef}
textAlign="center"
onChangeText={(value) => {
code.current = value;
- onNext();
+ //onNext();
}}
inputStyle={{
fontSize: SIZE.lg,
diff --git a/apps/mobile/app/components/auth/use-login.js b/apps/mobile/app/components/auth/use-login.js
index cfbbc8495..b329c9f51 100644
--- a/apps/mobile/app/components/auth/use-login.js
+++ b/apps/mobile/app/components/auth/use-login.js
@@ -75,6 +75,7 @@ export const useLogin = (onFinishLogin) => {
mfa.code,
mfa.method
);
+
if (success) {
setStep(LoginSteps.passwordAuth);
setLoading(false);