Commit d639d17d authored by Matthew Taylor's avatar Matthew Taylor Committed by GitHub

Merge pull request #827 from mewtaylor/issue/gh-816

[Develop] Hotfix: Remove `phoneLength` validation
parents f49d6e6a 6e3a18a5
...@@ -25,8 +25,7 @@ var PhoneInput = React.createClass({ ...@@ -25,8 +25,7 @@ var PhoneInput = React.createClass({
getDefaultProps: function () { getDefaultProps: function () {
return { return {
validations: { validations: {
isPhone: true, isPhone: true
phoneLength: true
}, },
flagsImagePath: '/images/flags.png', flagsImagePath: '/images/flags.png',
defaultCountry: 'us' defaultCountry: 'us'
...@@ -65,8 +64,7 @@ var PhoneInput = React.createClass({ ...@@ -65,8 +64,7 @@ var PhoneInput = React.createClass({
}); });
var phoneValidationHOC = validationHOCFactory({ var phoneValidationHOC = validationHOCFactory({
isPhone: <intl.FormattedMessage id="teacherRegistration.validationPhoneNumber" />, isPhone: <intl.FormattedMessage id="teacherRegistration.validationPhoneNumber" />
phoneLength: <intl.FormattedMessage id="teacherRegistration.validationPhoneNumber" />
}); });
module.exports = inputHOC(defaultValidationHOC(phoneValidationHOC(PhoneInput))); module.exports = inputHOC(defaultValidationHOC(phoneValidationHOC(PhoneInput)));
...@@ -21,14 +21,6 @@ module.exports.validations = { ...@@ -21,14 +21,6 @@ module.exports.validations = {
return false; return false;
} }
return phoneNumberUtil.isValidNumber(parsed); return phoneNumberUtil.isValidNumber(parsed);
},
phoneLength: function (values, value) {
if (typeof value === 'undefined') return true;
if (value && value.national_number === '+') return true;
if (value && value.national_number.length === value.country_code.format.length) {
return true;
}
return false;
} }
}; };
......
...@@ -416,7 +416,7 @@ module.exports = { ...@@ -416,7 +416,7 @@ module.exports = {
}; };
}, },
onValidSubmit: function (formData, reset, invalidate) { onValidSubmit: function (formData, reset, invalidate) {
if (formData.phone.national_number.length !== formData.phone.country_code.format.length) { if (!formData.phone || formData.phone.national_number === '+') {
return invalidate({ return invalidate({
'phone': this.props.intl.formatMessage({id: 'teacherRegistration.validationPhoneNumber'}) 'phone': this.props.intl.formatMessage({id: 'teacherRegistration.validationPhoneNumber'})
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment