-
Notifications
You must be signed in to change notification settings - Fork 0
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
Phone validation #125
base: master
Are you sure you want to change the base?
Phone validation #125
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ App.controller('memberprofileController', ['$scope', '$rootScope', '$stateParams | |
$scope.lastName = $scope.member.last_name; | ||
$scope.email = $scope.member.email; | ||
$scope.birthday = $scope.member.dob; | ||
$scope.phone = $scope.member.phone; | ||
$scope.phone = $scope.member.phone.replace(/[^0-9.]/g, ''); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want to allow dashes in the phone number here? |
||
$scope.currentAddress = $scope.member.address + " " + $scope.member.city + " " + $scope.member.state + " " + $scope.member.zip; | ||
$scope.position = $scope.member.position; | ||
$scope.permanentAddress = $scope.member.perm_address + " " + $scope.member.perm_city + " " + $scope.member.perm_state + " " + $scope.member.perm_zip; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
App.filter('phoneNumber', function() { | ||
return function(number) { | ||
if (number){ | ||
if (number.length === 10) { | ||
return number.slice(0, 3) + '-' + number.slice(3, 6) + '-' + number.slice(6, 10); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the phone number requires dashes with our pattern and we don't get rid of the dashes, then this filter isn't necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even though we have validation on the number with dashes, the database was storing just numbers. I'd rather store just the raw number without formatting because it is much easier to add formatting, than remove it if we decide to change the formatting later. Ex: 1-832-221-5607 or 832-221-5607, Opening text service on the phone is: "sms://+18322215607". It's easier to inject those '-' on just the raw american 10 digit number than remove whatever formatting and figure out when country code is already added. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we either need a filter for adding dashes, or removing them. It may be a good thing to go ahead and require the country code for storage and for the time being just assume america, and hide the country code for viewing |
||
} | ||
else{ | ||
return number; | ||
} | ||
} | ||
return number; | ||
}; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,23 @@ angular.module("App").run(function($rootScope, AUTH_EVENTS) { | |
alert('error = ' + error); | ||
} | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ignore me |
||
// $rootScope.$on('sendSMS', function(event, data){ | ||
// var parsed = JSON.parse(data); | ||
// var number = parsed.number; | ||
|
||
// //CONFIGURATION | ||
// var options = { | ||
// replaceLineBreaks: false, // true to replace \n by a new line, false by default | ||
// android: { | ||
// intent: 'INTENT' // send SMS with the native android SMS messaging | ||
// //intent: '' // send SMS without open any other app | ||
// } | ||
// }; | ||
|
||
// var success = function () { alert('Message sent successfully'); }; | ||
// var error = function (e) { alert('Message Failed:' + e); }; | ||
// sms.send(number, message, options, success, error); | ||
// } | ||
// }); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ <h1>Account Info</h1> | |
</md-input-container> | ||
<md-input-container class="md-default-theme required" ng-class="{ 'md-input-invalid' : (memberAccount.phone.$invalid && !memberAccount.phone.$pristine) || (memberAccount.phone.$invalid && submitted)}"> | ||
<label for="phone">###-###-####</label> | ||
<input type="tel" name="phone" ng-model="item.phone" required/> | ||
<input type="tel" name="phone" ng-model="item.phone" pattern="\d{3}-\d{3}-\d{4}" required/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we require a pattern, then the filter is just for the current numbers in our system? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea, just for displaying the numbers. |
||
<p class="text-danger invalid-text">Please select a valid phone number.</p> | ||
</md-input-container> | ||
<div class="form-group" ng-class="{ 'md-input-invalid' : (memberAccount.dob.$invalid && !memberAccount.dob.$pristine) || (memberAccount.dob.$invalid && submitted)}"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,8 @@ | |
"xml": false, | ||
"count": 1 | ||
} | ||
] | ||
], | ||
"MessageUI.framework": [] | ||
} | ||
} | ||
} | ||
|
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.
In reference to my previous comment, removing formatting for storage in database
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.
do we want to get rid of that debugger?
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.
nah, makes it more interesting for the sorority girls.