mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-14 15:09:59 -04:00
Merge pull request #827 from mewtaylor/issue/gh-816
[Develop] Hotfix: Remove `phoneLength` validation
This commit is contained in:
commit
d639d17d85
3 changed files with 3 additions and 13 deletions
|
@ -25,8 +25,7 @@ var PhoneInput = React.createClass({
|
|||
getDefaultProps: function () {
|
||||
return {
|
||||
validations: {
|
||||
isPhone: true,
|
||||
phoneLength: true
|
||||
isPhone: true
|
||||
},
|
||||
flagsImagePath: '/images/flags.png',
|
||||
defaultCountry: 'us'
|
||||
|
@ -65,8 +64,7 @@ var PhoneInput = React.createClass({
|
|||
});
|
||||
|
||||
var phoneValidationHOC = validationHOCFactory({
|
||||
isPhone: <intl.FormattedMessage id="teacherRegistration.validationPhoneNumber" />,
|
||||
phoneLength: <intl.FormattedMessage id="teacherRegistration.validationPhoneNumber" />
|
||||
isPhone: <intl.FormattedMessage id="teacherRegistration.validationPhoneNumber" />
|
||||
});
|
||||
|
||||
module.exports = inputHOC(defaultValidationHOC(phoneValidationHOC(PhoneInput)));
|
||||
|
|
|
@ -21,14 +21,6 @@ module.exports.validations = {
|
|||
return false;
|
||||
}
|
||||
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 = {
|
|||
};
|
||||
},
|
||||
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({
|
||||
'phone': this.props.intl.formatMessage({id: 'teacherRegistration.validationPhoneNumber'})
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue