diff --git a/src/context/locales/ba.json b/src/context/locales/ba.json index f32b24f2..9ed53a82 100644 --- a/src/context/locales/ba.json +++ b/src/context/locales/ba.json @@ -269,6 +269,7 @@ "saving": "Saving", "old_password": "Old Password", "old_password_is_incorrect": "Old Password is incorrect", + "new_password_must_be_different": "New password must be different from the old password", "create_new_account": "Create New Account", "the_following_details_must_be_filled_by_parents_or_guardians": "The following details must be filled by parents or guardians", "parent_name": "Parent/Guardian Name", diff --git a/src/context/locales/en.json b/src/context/locales/en.json index 4478d3d0..6942be0c 100644 --- a/src/context/locales/en.json +++ b/src/context/locales/en.json @@ -269,6 +269,7 @@ "saving": "Saving", "old_password": "Old Password", "old_password_is_incorrect": "Old Password is incorrect", + "new_password_must_be_different": "New password must be different from the old password", "create_new_account": "Create New Account", "the_following_details_must_be_filled_by_parents_or_guardians": "The following details must be filled by parents or guardians", "parent_name": "Parent/Guardian Name", diff --git a/src/context/locales/gu.json b/src/context/locales/gu.json index 20cf5a57..e0d7ecf8 100644 --- a/src/context/locales/gu.json +++ b/src/context/locales/gu.json @@ -269,6 +269,7 @@ "saving": "સેવ કરી રહ્યા છીએ", "old_password": "જૂનો પાસવર્ડ", "old_password_is_incorrect": "જૂનો પાસવર્ડ ખોટો છે", + "new_password_must_be_different": "નવો પાસવર્ડ જૂના પાસવર્ડથી અલગ હોવો જોઈએ", "create_new_account": "નવું એકાઉન્ટ બનાવો", "the_following_details_must_be_filled_by_parents_or_guardians": "નીચેની વિગતો માતાપિતા અથવા વાલીઓ દ્વારા ભરવાની રહેશે", "parent_name": "માતાપિતા/વાલીનું નામ", diff --git a/src/context/locales/hi.json b/src/context/locales/hi.json index f251bcdc..ee71faea 100644 --- a/src/context/locales/hi.json +++ b/src/context/locales/hi.json @@ -269,6 +269,7 @@ "saving": "सुरक्षित तरीके से रखा जा रहा है", "old_password": "पुराना संकेत शब्द", "old_password_is_incorrect": "पुराना पासवर्ड गलत है", + "new_password_must_be_different": "नया पासवर्ड पुराने पासवर्ड से अलग होना चाहिए", "create_new_account": "नया खाता खोले", "the_following_details_must_be_filled_by_parents_or_guardians": "निम्नलिखित विवरणों को माता-पिता या संरक्षक द्वारा भरा जाना चाहिए", "parent_name": "माता-पिता/संरक्षक का नाम", diff --git a/src/context/locales/kn.json b/src/context/locales/kn.json index efbd295a..3c20e05a 100644 --- a/src/context/locales/kn.json +++ b/src/context/locales/kn.json @@ -269,6 +269,7 @@ "saving": "ಉಳಿಸಲಾಗುತ್ತಿದೆ", "old_password": "ಹಳೆಯ ಪಾಸ್‌ವರ್ಡ್", "old_password_is_incorrect": "ಹಳೆಯ ಪಾಸ್‌ವರ್ಡ್ ತಪ್ಪಾಗಿದೆ", + "new_password_must_be_different": "ಹೊಸ ಪಾಸ್‌ವರ್ಡ್ ಹಳೆಯ ಪಾಸ್‌ವರ್ಡ್‌ಗಿಂತ ಭಿನ್ನವಾಗಿರಬೇಕು", "create_new_account": "ಹೊಸ ಖಾತೆಯನ್ನು ರಚಿಸಿ", "the_following_details_must_be_filled_by_parents_or_guardians": "ಈ ಕೆಳಗಿನ ವಿವರಗಳನ್ನು ಪೋಷಕರು ಅಥವಾ ಪೋಷಕರು ಭರ್ತಿ ಮಾಡಬೇಕು", "parent_name": "ಪೋಷಕರು/ಪಾಲಕರು ಹೆಸರು", @@ -325,7 +326,7 @@ "resend_otp_in": "{count} ಗಳಲ್ಲಿ OTP ಅನ್ನು ಮತ್ತೆ ಕಳುಹಿಸಿ", "verify_otp": "OTP ಪರಿಶೀಲಿಸಿ", "unable_to_send_otp": "OTP ಕಳುಹಿಸಲು ಸಾಧ್ಯವಾಗುತ್ತಿಲ್ಲ", - "min_validation": "{ಕ್ಷೇತ್ರ} ಕನಿಷ್ಠ {length} ಅಕ್ಷರಗಳನ್ನು ಹೊಂದಿರಬೇಕು", + "min_validation": "{field} ಕನಿಷ್ಠ {length} ಅಕ್ಷರಗಳನ್ನು ಹೊಂದಿರಬೇಕು", "max_validation": "{ಕ್ಷೇತ್ರ} ಗರಿಷ್ಠ {length} ಅಕ್ಷರಗಳನ್ನು ಹೊಂದಿರಬೇಕು", "settings": "ಸೆಟ್ಟಿಂಗ್‌ಗಳು", "q2_a_bit_more": "ನಿಮ್ಮ ಬಗ್ಗೆ ಸ್ವಲ್ಪ ಹೆಚ್ಚು", diff --git a/src/context/locales/ma.json b/src/context/locales/ma.json index 9b7453f5..165bd137 100644 --- a/src/context/locales/ma.json +++ b/src/context/locales/ma.json @@ -269,6 +269,7 @@ "saving": "सुरक्षितपणे ठेवली जात आहे", "old_password": "जुना संकेत शब्द", "old_password_is_incorrect": "जुना पासवर्ड चुकीचा आहे", + "new_password_must_be_different": "नवीन पासवर्ड जुन्या पासवर्डपेक्षा वेगळा असणे आवश्यक आहे", "create_new_account": "नवीन खाते उघडा", "the_following_details_must_be_filled_by_parents_or_guardians": "खालील तपशील पालक किंवा संरक्षकाने भरले पाहिजे", "parent_name": "पालक/संरक्षकाचे नाव", diff --git a/src/context/locales/odia.json b/src/context/locales/odia.json index 200ad4e2..1a314530 100644 --- a/src/context/locales/odia.json +++ b/src/context/locales/odia.json @@ -269,6 +269,7 @@ "saving": "ସେଭ ହେଉଛି", "old_password": "ପୁରୁଣା ପାସୱାର୍ଡ", "old_password_is_incorrect": "ପୁରୁଣା ପାସୱାର୍ଡ ଭୁଲ ଅଟେ", + "new_password_must_be_different": "ନୂଆ ପାସୱାର୍ଡ ପୁରୁଣା ପାସୱାର୍ଡଠାରୁ ଭିନ୍ନ ହେବା ଆବଶ୍ୟକ", "create_new_account": "ନୂଆ ଏକାଉଣ୍ଟ ତିଆରି କରନ୍ତୁ", "the_following_details_must_be_filled_by_parents_or_guardians": "ନିମ୍ନଲିଖିତ ବିବରଣୀ ପିତାମାତା କିମ୍ବା ଅଭିଭାବକଙ୍କ ଦ୍ୱାରା ପୂରଣ କରାଯିବା ଆବଶ୍ୟକ", "parent_name": "ପିତାମାତା/ଅଭିଭାବକଙ୍କ ନାମ", diff --git a/src/context/locales/ta.json b/src/context/locales/ta.json index 8a4eaf53..0056768f 100644 --- a/src/context/locales/ta.json +++ b/src/context/locales/ta.json @@ -269,6 +269,7 @@ "saving": "சேமிக்கப்படுகிறது", "old_password": "பழைய பாஸ்வேர்டு", "old_password_is_incorrect": "பழைய பாஸ்வேர்டு தவறாக உள்ளது", + "new_password_must_be_different": "புதிய கடவுச்சொல் பழைய கடவுச்சொல்லிலிருந்து வேறுபட்டதாக இருக்க வேண்டும்", "create_new_account": "புதிய கணக்கை உருவாக்கவும்", "the_following_details_must_be_filled_by_parents_or_guardians": "கீழே உள்ள விவரங்களை பெற்றோர் அல்லது பாதுகாவலர் நிரப்ப வேண்டும்", "parent_name": "பெற்றோர் / பாதுகாவலரின் பெயர்", diff --git a/src/context/locales/te.json b/src/context/locales/te.json index f64f052a..b98aa431 100644 --- a/src/context/locales/te.json +++ b/src/context/locales/te.json @@ -269,6 +269,7 @@ "saving": "సేవ్", "old_password": "పాత పాస్‌వర్డ్", "old_password_is_incorrect": "పాత పాస్‌వర్డ్ తప్పు", + "new_password_must_be_different": "కొత్త పాస్‌వర్డ్ పాత పాస్‌వర్డ్‌కు భిన్నంగా ఉండాలి", "create_new_account": "కొత్త ఖాతాను సృష్టించండి", "the_following_details_must_be_filled_by_parents_or_guardians": "కింది వివరాలను తల్లిదండ్రులు లేదా సంరక్షకులు పూరించాలి", "parent_name": "తల్లిదండ్రులు/సంరక్షకుల పేరు", @@ -325,7 +326,7 @@ "resend_otp_in": "{count}లలో OTPని తిరిగి పంపండి", "verify_otp": "OTPని ధృవీకరించండి", "unable_to_send_otp": "OTP పంపలేకపోయింది", - "min_validation": "{ఫీల్డ్} కనీసం {length} అక్షరాలు ఉండాలి", + "min_validation": "{field} కనీసం {length} అక్షరాలు ఉండాలి", "max_validation": "{field} గరిష్టంగా {length} అక్షరాలు ఉండాలి", "settings": "సెట్టింగ్‌లు", "q2_a_bit_more": "మీ గురించి కొంచెం ఎక్కువ", diff --git a/src/context/locales/ur.json b/src/context/locales/ur.json index 32f82aef..9dc910c8 100644 --- a/src/context/locales/ur.json +++ b/src/context/locales/ur.json @@ -269,6 +269,7 @@ "saving": "محفوظ کریں", "old_password": "پرانا پاس ورڈ", "old_password_is_incorrect": "پرانا پاس ورڈ غلط ہے۔", + "new_password_must_be_different": "نیا پاس ورڈ پرانے پاس ورڈ سے مختلف ہونا چاہیے", "create_new_account": "نیا اکاؤنٹ بنائیں", "the_following_details_must_be_filled_by_parents_or_guardians": "مندرجہ ذیل تفصیلات والدین یا سرپرستوں کی طرف سے پُر کرنا ضروری ہے۔", "parent_name": "والدین/سرپرست کا نام", diff --git a/src/screens/ForgotPassword/ResetPassword.js b/src/screens/ForgotPassword/ResetPassword.js index 0b8323d3..924a3f33 100644 --- a/src/screens/ForgotPassword/ResetPassword.js +++ b/src/screens/ForgotPassword/ResetPassword.js @@ -19,6 +19,8 @@ import SecondaryHeader from '../../components/Layout/SecondaryHeader'; import { getDataFromStorage } from '../../utils/JsHelper/Helper'; import GlobalText from '@components/GlobalText/GlobalText'; +const MIN_PASSWORD_LENGTH = 4; + const ResetPassword = () => { const [password, setPassword] = useState(''); const [oldPassword, setOldPassword] = useState(''); @@ -30,6 +32,8 @@ const ResetPassword = () => { const [isDisabled, setIsDisabled] = useState(true); const [passwordError, setPasswordError] = useState(false); const [oldPasswordError, setOldPasswordError] = useState(false); + const [samePasswordError, setSamePasswordError] = useState(false); + const [minLengthError, setMinLengthError] = useState(false); const { t } = useTranslation(); const navigation = useNavigation(); @@ -47,6 +51,8 @@ const ResetPassword = () => { const handleOldPassword = (e) => { setOldPassword(e.trim()); + setOldPasswordError(false); + setSamePasswordError(false); if (e.trim() === '') { setIsDisabled(true); } else if (ConfirmPassword == '' && password == '') { @@ -55,6 +61,8 @@ const ResetPassword = () => { }; const handlePassword = (e) => { setPassword(e.trim()); + setSamePasswordError(false); + setMinLengthError(false); if (e.trim() === '') { setIsDisabled(true); } else if (ConfirmPassword !== '' && e.trim() !== ConfirmPassword) { @@ -80,6 +88,14 @@ const ResetPassword = () => { }; const handlelogin = async () => { + if (password.length < MIN_PASSWORD_LENGTH) { + setMinLengthError(true); + return; + } + if (password === oldPassword) { + setSamePasswordError(true); + return; + } const payload = { username: userName, password: oldPassword, @@ -196,6 +212,36 @@ const ResetPassword = () => { {t('old_password_is_incorrect')} )} + {samePasswordError && ( + + {t('new_password_must_be_different')} + + )} + {minLengthError && ( + + {t('min_validation') + .replace('{field}', t('new_password')) + .replace('{length}', MIN_PASSWORD_LENGTH)} + + )} { { textAlign: 'center', marginVertical: 10 }, ]} > - {t(failed_to_reset_password)} + {t('failed_to_reset_password')} ) : ( <>