-
Notifications
You must be signed in to change notification settings - Fork 249
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(authenticator): required phone number validator #4106
Conversation
/// The "+" prefix is excluded since validation is performed against the number | ||
/// without the prefix. That is, if the full number is "+1-123-555-7890", the | ||
/// "+1" is dropped prior to validation. | ||
final phoneNumberRegex = RegExp(r'^d+$'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this meant to match? Should it not be ^[0-9]+$
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or ^\d+$
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the \
should not have been removed. Updated.
@@ -118,6 +118,44 @@ void main() { | |||
}, | |||
); | |||
|
|||
testWidgets( | |||
'displays message when submitted with empty phone number if the field is required', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Does this test cover the issue that triggered this change? It's unclear how this test was untrue before the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Line 149 would fail today on main as the phone number is currently never considered empty as there is always a dial code.
* fix(authenticator):required phone number validator * fix: typo in validator
- fix(api): GraphQL Model Helpers support lowercase model names #4143 (#4144) - fix(authenticator): required phone number validator ([#4106](#4106)) - fix(core): pub docs ([#4049](#4049)) - fix(datastore): emit observeQuery snapshot when model create mutation results in an updated model ([#4084](#4084)) Updated-Components: amplify_lints, Amplify Flutter, Amplify Dart, Amplify UI, DB Common, Secure Storage, AWS Common, Smithy, Worker Bee
### Fixes - fix(api): GraphQL Model Helpers support lowercase model names #4143 (#4144) - fix(authenticator): required phone number validator ([#4106](#4106)) - fix(core): pub docs ([#4049](#4049)) - fix(datastore): emit observeQuery snapshot when model create mutation results in an updated model ([#4084](#4084)) Updated-Components: amplify_lints, Amplify Flutter, Amplify Dart, Amplify UI, DB Common, Secure Storage, AWS Common, Smithy, Worker Bee
* fix(authenticator):required phone number validator * fix: typo in validator
### Fixes - fix(api): GraphQL Model Helpers support lowercase model names #4143 (#4144) - fix(authenticator): required phone number validator ([#4106](#4106)) - fix(core): pub docs ([#4049](#4049)) - fix(datastore): emit observeQuery snapshot when model create mutation results in an updated model ([#4084](#4084)) Updated-Components: amplify_lints, Amplify Flutter, Amplify Dart, Amplify UI, DB Common, Secure Storage, AWS Common, Smithy, Worker Bee
### Fixes - fix(api): GraphQL Model Helpers support lowercase model names #4143 (#4144) - fix(authenticator): required phone number validator ([#4106](#4106)) - fix(core): pub docs ([#4049](#4049)) - fix(datastore): emit observeQuery snapshot when model create mutation results in an updated model ([#4084](#4084)) Updated-Components: amplify_lints, Amplify Flutter, Amplify Dart, Amplify UI, DB Common, Secure Storage, AWS Common, Smithy, Worker Bee
### Fixes - fix(api): GraphQL Model Helpers support lowercase model names #4143 (#4144) - fix(authenticator): required phone number validator ([#4106](#4106)) - fix(core): pub docs ([#4049](#4049)) - fix(datastore): emit observeQuery snapshot when model create mutation results in an updated model ([#4084](#4084)) Updated-Components: amplify_lints, Amplify Flutter, Amplify Dart, Amplify UI, DB Common, Secure Storage, AWS Common, Smithy, Worker Bee
Issue #, if available: #4079
Description of changes:
The country code is populated from a drop down list of known valid numbers so there is no need to validate it. Including it in validation makes it challenging to check for a blank phone number since the country code is always present.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.