Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ✨ allows users to enter accented name characters #7832

Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
67d531f
fix: :sparkles: allows users to enter accented name characters
shaheer-deriv Mar 7, 2023
4bbe640
chore: :wastebasket: removes unused 'letter_symbol' variable
shaheer-deriv Mar 8, 2023
9ce7b7a
Merge branch 'binary-com:master' into shaheer/90186/last-name-input-v…
shaheer-deriv Mar 8, 2023
94c7ea8
fix: :bug: allows accented characters in name for existing users
shaheer-deriv Mar 8, 2023
0d1bf15
Merge branch 'binary-com:master' into shaheer/90186/last-name-input-v…
shaheer-deriv Mar 9, 2023
bc44028
Merge branch 'binary-com:master' into shaheer/90186/last-name-input-v…
shaheer-deriv Mar 13, 2023
8ff10d7
Merge branch 'binary-com:master' into shaheer/90186/last-name-input-v…
shaheer-deriv Mar 14, 2023
d78d579
Merge branch 'binary-com:master' into shaheer/90186/last-name-input-v…
shaheer-deriv Mar 15, 2023
7b571bf
Merge branch 'master' into shaheer/90186/last-name-input-validation
shaheer-deriv Mar 15, 2023
fd27880
docs: :pencil2: comment on the regex used for name validation
shaheer-deriv Mar 15, 2023
20e0d2a
resused regex function
shaheer-deriv Mar 16, 2023
449e5bf
Merge branch 'master' into shaheer/90186/last-name-input-validation
shaheer-deriv Mar 16, 2023
c5afae2
fix: :memo: imported reused regex function
shaheer-deriv Mar 16, 2023
de4037d
Merge branch 'master' into shaheer/90186/last-name-input-validation
shaheer-deriv Mar 16, 2023
b2d392c
fix: :memo: comment on regex function used
shaheer-deriv Mar 16, 2023
ef6e34d
Merge branch 'master' into shaheer/90186/last-name-input-validation
shaheer-deriv Mar 17, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@ export const PersonalDetailsForm = ({
}

validateValues(val => val, required_fields, localize('This field is required'));
const only_alphabet_fields = ['first_name', 'last_name'];
validateValues(validLetterSymbol, only_alphabet_fields, localize('Only alphabet is allowed'));

const residence_fields = ['citizen'];
const validateResidence = val => getLocation(residence_list, val, 'value');
Expand Down Expand Up @@ -349,12 +347,17 @@ export const PersonalDetailsForm = ({

const min_name = 2;
const max_name = 50;
if (values.first_name && !validLength(values.first_name.trim(), { min: min_name, max: max_name })) {
errors.first_name = localize('You should enter 2-50 characters.');
}
if (values.last_name && !validLength(values.last_name.trim(), { min: min_name, max: max_name })) {
errors.last_name = localize('You should enter 2-50 characters.');
}
const validateName = (name, field) => {
if (name) {
if (!validLength(name.trim(), { min: min_name, max: max_name })) {
errors[field] = localize('You should enter 2-50 characters.');
} else if (!/^(?!.*\s{2,})[\p{L}\s'.-]{2,50}$/u.test(name)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest writing a test case for this line and also add some comments explaining the regex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shaheer-deriv marked this conversation as resolved.
Show resolved Hide resolved
errors[field] = localize('Letters, spaces, periods, hyphens, apostrophes only.');
}
}
};
validateName(values.first_name, 'first_name');
validateName(values.last_name, 'last_name');

if (values.phone) {
// minimum characters required is 9 numbers (excluding +- signs or space)
Expand Down