Skip to content

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

mobile: fix pass validation

ammarahm-ed8c9d98ab889e
diff --git a/apps/mobile/app/components/ui/input/index.tsx b/apps/mobile/app/components/ui/input/index.tsx
index 87339cb2a..3f343c10e 100644
--- a/apps/mobile/app/components/ui/input/index.tsx
+++ b/apps/mobile/app/components/ui/input/index.tsx
@@ -112,7 +112,7 @@ const Input = ({
const [secureEntry, setSecureEntry] = useState(true);
const [showError, setShowError] = useState(false);
const [errorList, setErrorList] = useState({
- SHORT_PASS: true
+ SHORT_PASS: false
});
type ErrorKey = keyof typeof errorList;
const color = error
@@ -187,6 +187,12 @@ const Input = ({
onChangeText && onChangeText(value);
setShowError(false);
validate(value);
+ if (value === "") {
+ setError(false);
+ setErrorList({
+ SHORT_PASS: false
+ });
+ }
};
const onBlur = () => {
diff --git a/apps/mobile/app/services/validation.js b/apps/mobile/app/services/validation.js
index c43705241..abfcf381e 100644
--- a/apps/mobile/app/services/validation.js
+++ b/apps/mobile/app/services/validation.js
@@ -36,14 +36,12 @@ export function validatePass(password) {
SHORT_PASS: false
};
- if (password?.length <= 0) {
+ if (password?.length < 8) {
errors.SHORT_PASS = true;
- return errors;
- }
-
- if (password.length >= 8) {
+ } else {
errors.SHORT_PASS = false;
}
+
return errors;
}