-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[HOLD Paypal feature update][$1000] Web - It does not show error message if PayPal username has leading or trailing space #23791
Comments
Triggered auto assignment to @maddylewis ( |
Bug0 Triage Checklist (Main S/O)
|
ProposalPlease re-state the problem that we are trying to solve in this issue.When adding a PayPal.me username, leading or trailing spaces as part of the username are accepted as valid. What is the root cause of that problem?In the What changes do you think we should make in order to solve the problem?Get the actual raw value from the input field using a state variable and use that as the value to be validated instead of We can make the following changes to achieve this:
What alternative solutions did you explore? (Optional)None. |
ProposalPlease re-state the problem that we are trying to solve in this issue.It does not show error message if PayPal username has leading or trailing space What is the root cause of that problem?During validation, it checks the input against the regular expression App/src/pages/settings/Payments/AddPayPalMePage.js Lines 39 to 46 in ba08d3d
However, the Line 127 in ba08d3d
Therefore leading to the regular expression passing. What changes do you think we should make in order to solve the problem?Option 1. We pass the trimmed value to const validate = (values, rawValues) => { And then we use rawValues.payPalMeUsername for validation. What alternative solutions did you explore? (Optional)Alternatively, we can make the trimming behavior optional via a new prop in Form. Or perhaps it make sense that Form also uses the trimmed values when calling submit, since that's what we're validating. This should be discussed in Slack. |
Job added to Upwork: https://www.upwork.com/jobs/~01caff7fb052f5762f |
Current assignee @maddylewis is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
this is cause by a regression - https://expensify.slack.com/archives/C049HHMV9SM/p1690526905961579?thread_ts=1690526881.707709&cid=C049HHMV9SM |
Yes, but I think it's also a symptom of a deeper rooted problem with the |
ProposalGo to file CONST.js located in 'https://github.com/Expensify/App/blob/main/src/CONST.js#L1131' path. Done and dusted. It will show error if there are any leading or trailing spaces. If the issue is still not solved, I can provide more guidance of what you exactly need to do. I just need to play around with the Regex here and it will be done. I will also apply for the job at Upwork! |
📣 @vatsal-git! 📣
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
ProposalPlease re-state the problem that we are trying to solve in this issue.When adding a PayPal.me username, leading or trailing spaces as part of the username are accepted as valid which is wrong. It should not add PayPal.me username which has leading or trailing spaces. What is the root cause of that problem?The root cause of the problem in the Regex which is validating PAYPAL_ME_USERNAME. Here it is: Line 1146 in eb02006
What changes do you think we should make in order to solve the problem?We can solve this problem by updating the Regex for PAYPAL_ME_USERNAME in such a way that it also checks for leading or trailing spaces. What alternative solutions did you explore? (Optional)Alternatively, we can look into the onInputChange function here: Line 321 in ba08d3d
It is quite possible that the leading and trailing spaces are getting trimmed before the Regex validation. Line 127 in ba08d3d
We can make a check on this not to trim PAYPAL_ME_USERNAME. This will solve the problem. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Paypal.me username is being added and saved(after trimming) even when user adds leading/trailing spaces to the name. Paypal username if entered with leading/trailing spaces should throw error. What is the root cause of that problem?Root cause of this problem is that we are trimming the PayPal username and then passing that trimmed value to the regex(where it is checking for string validation). Regex What changes do you think we should make in order to solve the problem?If we want error message to be displayed when username has leading/trailing space, we will have to pass that value as it is here and not trim it. Currently our const onValidate = useCallback(
(values) => {
const trimmedStringValues = {};
_.each(values, (inputValue, inputID) => {
if (_.isString(inputValue)) {
if(props.disableTrim.includes(inputID))
trimmedStringValues[inputID] = inputValue;
else
trimmedStringValues[inputID] = inputValue.trim();
} else {
trimmedStringValues[inputID] = inputValue;
}
}); Default value for prop What alternative solutions did you explore? (Optional) |
Adding a video here with the above change. Screen.Recording.2023-07-30.at.5.07.35.PM.mov |
|
@sobitneupane - will you review these proposals when you have a chance? thanks! |
Thanks for the proposal everyone. Proposal by @samh-nl looks good to me.
If we don't mind user adding spaces in the beginning and end for paypal address, we can go with the first option.
But to align with previous condition before having Form refactor, we can pass the non-trimmed value as 2nd argument from form component itself and use it where ever required. @samh-nl Are there any other places where |
Started a discussion for expected output: https://expensify.slack.com/archives/C01GTK53T8Q/p1690999903863719 |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@sobitneupane I think arguably all form validation should use the non-trimmed values (or alternatively, submit should pass trimmed values to make it consistent with what is actually validated), and if a field is required If we want to limit the scope to PayPal: if there are surrounding spaces this seems like a user typo since PayPal.me usernames cannot contain spaces, so option 1 seems reasonable. |
@sobitneupane - do we think this is worth fixing based on this comment? https://expensify.slack.com/archives/C01GTK53T8Q/p1691006515807909?thread_ts=1690999903.863719&cid=C01GTK53T8Q |
Triggered auto assignment to @Christinadobrzyn ( |
This comment was marked as duplicate.
This comment was marked as duplicate.
@Christinadobrzyn - i am OOO until ~Aug 20. we are chatting in Slack about the proposed fix for this one - #23791 (comment) That said, @JmillsExpensify made a comment here that makes me think this might not be worth fixing if we're going to deprecate this feature altogether at some point - https://expensify.slack.com/archives/C01GTK53T8Q/p1691006515807909?thread_ts=1690999903.863719&cid=C01GTK53T8Q |
I'll follow this thread over the coming days to see if this should stay open. https://expensify.slack.com/archives/C01GTK53T8Q/p1691006515807909?thread_ts=1690999903.863719&cid=C01GTK53T8Q |
I don't have a formal proposal at the moment, to be clear. I do think we should do this eventually though. |
@sobitneupane, @maddylewis, @Christinadobrzyn Whoops! This issue is 2 days overdue. Let's get this updated quick! |
It sounds like this should be on hold for now. Going to move this to monthly for tracking |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
It should show invalid username error (same as previous version) or trim username
Actual Result:
It does not show invalid username error and username shifts left side on click of add Paypal account
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.47-2
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Screen.Recording.2023-07-28.at.12.16.21.PM.mov
Recording.3964.mp4
Expensify/Expensify Issue URL:
Issue reported by: @gadhiyamanan
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690526881707709
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: