Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/context/locales/ba.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/context/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/context/locales/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "માતાપિતા/વાલીનું નામ",
Expand Down
1 change: 1 addition & 0 deletions src/context/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "माता-पिता/संरक्षक का नाम",
Expand Down
3 changes: 2 additions & 1 deletion src/context/locales/kn.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "ಪೋಷಕರು/ಪಾಲಕರು ಹೆಸರು",
Expand Down Expand Up @@ -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": "ನಿಮ್ಮ ಬಗ್ಗೆ ಸ್ವಲ್ಪ ಹೆಚ್ಚು",
Expand Down
1 change: 1 addition & 0 deletions src/context/locales/ma.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "पालक/संरक्षकाचे नाव",
Expand Down
1 change: 1 addition & 0 deletions src/context/locales/odia.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "ପିତାମାତା/ଅଭିଭାବକଙ୍କ ନାମ",
Expand Down
1 change: 1 addition & 0 deletions src/context/locales/ta.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "பெற்றோர் / பாதுகாவலரின் பெயர்",
Expand Down
3 changes: 2 additions & 1 deletion src/context/locales/te.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "తల్లిదండ్రులు/సంరక్షకుల పేరు",
Expand Down Expand Up @@ -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": "మీ గురించి కొంచెం ఎక్కువ",
Expand Down
1 change: 1 addition & 0 deletions src/context/locales/ur.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "والدین/سرپرست کا نام",
Expand Down
48 changes: 47 additions & 1 deletion src/screens/ForgotPassword/ResetPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand All @@ -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();

Expand All @@ -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 == '') {
Expand All @@ -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) {
Expand All @@ -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,
Expand Down Expand Up @@ -196,6 +212,36 @@ const ResetPassword = () => {
{t('old_password_is_incorrect')}
</Text>
)}
{samePasswordError && (
<Text
allowFontScaling={false}
style={{
color: 'red',
alignSelf: 'flex-start',
marginBottom: 10,
marginTop: -20,
fontFamily: 'Poppins-Regular',
}}
>
{t('new_password_must_be_different')}
</Text>
)}
{minLengthError && (
<Text
allowFontScaling={false}
style={{
color: 'red',
alignSelf: 'flex-start',
marginBottom: 10,
marginTop: -20,
fontFamily: 'Poppins-Regular',
}}
>
{t('min_validation')
.replace('{field}', t('new_password'))
.replace('{length}', MIN_PASSWORD_LENGTH)}
</Text>
)}
<PrimaryButton
isDisabled={isDisabled}
onPress={handlelogin}
Expand Down Expand Up @@ -236,7 +282,7 @@ const ResetPassword = () => {
{ textAlign: 'center', marginVertical: 10 },
]}
>
{t(failed_to_reset_password)}
{t('failed_to_reset_password')}
</Text>
) : (
<>
Expand Down