Skip to content

Commit

Permalink
Aadhar validation and hindi character validation (tekdi#8)
Browse files Browse the repository at this point in the history
* fix:if the language is changed on any page, the app toggles to first page + When the user move back and come on the state, district, block page it appear blank

* fix:error solving

* fix:remove credentials popup module + remove email id

* fix:prerak bio Work Experience and Volunteer Experience

* feat:CICD

* Merge branch 'master' of https://github.com/tekdi/eg-website

* fix:aadhar validation and hindi character validation
  • Loading branch information
sagarkoshti1990 authored May 10, 2023
1 parent da86ef9 commit afe30f0
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 12 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/sandbox-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CICD
on:
push:
branches:
- master
jobs:
build:
name: build-deploy-to-sandbox
environment: sandbox
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
yarn install
yarn workspace @shiksha/common-lib build
yarn install
yarn build
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_HOST }}
- name: Adding known hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Copy Package
run: |
sh ./scripts/pack-prod-build.sh
rsync eg-website.tar ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/html/eg-website.tar
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /var/www/html
rm -rf *
cp ../eg-website.tar ./
tar -xvf eg-website.tar .
7 changes: 3 additions & 4 deletions apps/front-end/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"ALREADY_APPLIED_CHECK_STATUS": "Already Applied? Check Status",
"PRERAK_DUTIES": "Prerak Duties",
"KNOW_PRERAK_DUTIES": "Know Your Prerak Duties",

"APPLY_NOW": "Apply Now",
"CLEAR_PROFILE_MESSAGE": "Make sure this image has a clear profile view of your Face. Improper Image might result in disqualification of the Application.",
"ADD_PROFILE_PHOTO": "Add Your Profile Photo",
Expand Down Expand Up @@ -70,8 +69,8 @@
"AADHAAR_NO": "Aadhaar No",
"EDUCATION": "Education",
"ROLE": "Role",
"YEARS_OF_EX": "years of ex",
"DESCRIPTION": "description",
"YEARS_OF_EX": "Years of ex",
"DESCRIPTION": "Description",
"OTHER_DETAILS": "Other Details",
"DEVICE_OWNERSHIP": "Device Ownership",
"TYPE_OF_DEVICE": "Type of Device",
Expand Down Expand Up @@ -186,7 +185,7 @@
"Offline": "Offline",
"MINIMUM_LENGTH_IS_10": "Minimum length is 10",
"PLEASE_ENTER_VALID_NUMBER": "please enter valid number",
"AADHAAR_NUMBERS_SHOULD_BE_12_DIGIT_IN_LENGTH": "Aadhaar numbers should be 12 digit in length",
"AADHAAR_SHOULD_BE_12_DIGIT_VALID_NUMBER": "Aadhaar should be 12 digit valid number",
"MINIMUM_AGE_18_YEAR_OLD": "Minimum age 18 year old",
"MOBILE_NUMBER_ALREADY_EXISTS": "mobile number already exists",
"HELP": "Help ?",
Expand Down
2 changes: 1 addition & 1 deletion apps/front-end/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"Offline": "ऑफलाइन",
"MINIMUM_LENGTH_IS_10": "10 अंकों की संख्या दर्ज करें",
"PLEASE_ENTER_VALID_NUMBER": "कृपया वैध संख्या दर्ज करें",
"AADHAAR_NUMBERS_SHOULD_BE_12_DIGIT_IN_LENGTH": "आधार संख्या 12 अंक होनी चाहिए",
"AADHAAR_SHOULD_BE_12_DIGIT_VALID_NUMBER": "आधार 12 अंकों का मान्य नंबर होना चाहिए",
"MINIMUM_AGE_18_YEAR_OLD": "न्यूनतम आयु 18 वर्ष",
"MOBILE_NUMBER_ALREADY_EXISTS": "मोबाइल नंबर पहले से ही मौजूद है",
"NEED_HELP": "मदद की ज़रूरत है",
Expand Down
30 changes: 23 additions & 7 deletions apps/front-end/src/pages/front-end/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export default function App({ facilitator, ip, onClick }) {
if (id) {
newPage = newSteps.filter((e) => !arr.includes(e));
// const pageSet = form_step_number ? form_step_number : 3;
const pageSet = "8";
const pageSet = "3";
setPage(pageSet);
setSchema(properties[pageSet]);
} else {
Expand All @@ -358,9 +358,11 @@ export default function App({ facilitator, ip, onClick }) {
setYearsRange([minYear.year(), maxYear.year()]);
setSubmitBtn(t("NEXT"));
}
const data = localStorage.getItem(`id_data_${facilitator?.id}`);
const newData = JSON.parse(data);
setFormData({ ...newData, ...facilitator });
if (facilitator?.id) {
const data = localStorage.getItem(`id_data_${facilitator?.id}`);
const newData = JSON.parse(data);
setFormData({ ...newData, ...facilitator });
}
}, []);

const updateBtnText = () => {
Expand Down Expand Up @@ -433,9 +435,12 @@ export default function App({ facilitator, ip, onClick }) {
}
}
if (data?.aadhar_token) {
if (data?.aadhar_token?.toString()?.length !== 12) {
errors.aadhar_token.addError(
t("AADHAAR_NUMBERS_SHOULD_BE_12_DIGIT_IN_LENGTH")
if (
data?.aadhar_token &&
!data?.aadhar_token?.match(/^[2-9]{1}[0-9]{3}[0-9]{4}[0-9]{4}$/)
) {
errors?.aadhar_token?.addError(
`${t("AADHAAR_SHOULD_BE_12_DIGIT_VALID_NUMBER")}`
);
}
}
Expand All @@ -452,6 +457,17 @@ export default function App({ facilitator, ip, onClick }) {
);
}
});
["vo_experience", "experience"].forEach((keyex) => {
data?.[keyex]?.map((item, index) => {
["role_title", "organization", "description"].forEach((key) => {
if (item?.[key] && !item?.[key]?.match(/^[a-zA-Z ]*$/g)) {
errors[keyex][index]?.[key]?.addError(
`${t("REQUIRED_MESSAGE")} ${t(schema?.properties?.[key]?.title)}`
);
}
});
});
});

return errors;
};
Expand Down

0 comments on commit afe30f0

Please sign in to comment.