[fix] Different types of phone numbers are allowed, but only mobile types should#487
Merged
nemesifier merged 2 commits intoopenwisp:masterfrom Sep 1, 2023
ujjwalkirti:master
Merged
[fix] Different types of phone numbers are allowed, but only mobile types should#487nemesifier merged 2 commits intoopenwisp:masterfrom ujjwalkirti:master
nemesifier merged 2 commits intoopenwisp:masterfrom
ujjwalkirti:master
Conversation
Contributor
Author
|
@nemesifier can you please review this PR for the issue #484 |
nemesifier
requested changes
Aug 23, 2023
Member
nemesifier
left a comment
There was a problem hiding this comment.
@ujjwalkirti thanks for contributing! We need a failing unit test which replicates the bug before we can merge a fix. Do you know how to write tests? If you look at https://github.com/openwisp/openwisp-radius/blob/master/openwisp_radius/tests/test_api/test_phone_verification.py you can find plenty of examples.
openwisp_radius/api/serializers.py
Outdated
| org = self.context['view'].organization | ||
| if get_organization_radius_settings(org, 'sms_verification'): | ||
| if phonenumbers.phonenumberutil.number_type(phone_number) != 1: | ||
| raise serializers.ValidationError(_('Landline numbers can\'t be used to send SMS.')) |
Member
There was a problem hiding this comment.
I'd write that only mobile phone numbers are allowed.
Contributor
Author
There was a problem hiding this comment.
Okay, I will make the required changes.
Member
|
Hey @ujjwalkirti!! Thank for contributing. I will be taking over this PR to complete it. |
Closes #484 Co-authored-by: Gagan Deep <[email protected]>
[skip ci]
nemesifier
approved these changes
Sep 1, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I changed the code to check whether phone_number provided is a Mobile number and raise expception if not. (#484 )
Below is the function code that I have altered.
Closes #484
Edited by @pandafy