Validate number before showing step 4
// FREEBIE
This commit is contained in:
parent
f11cfcb996
commit
e5c6541e6c
1 changed files with 5 additions and 1 deletions
|
@ -26,8 +26,12 @@
|
||||||
new QRCode(this.$('#qr')[0]).makeCode(url);
|
new QRCode(this.$('#qr')[0]).makeCode(url);
|
||||||
},
|
},
|
||||||
confirmNumber: function(number) {
|
confirmNumber: function(number) {
|
||||||
|
var parsed = libphonenumber.parse(number);
|
||||||
|
if (!libphonenumber.isValidNumber(parsed)) {
|
||||||
|
throw new Error('Invalid number');
|
||||||
|
}
|
||||||
this.$('#step4 .number').text(libphonenumber.format(
|
this.$('#step4 .number').text(libphonenumber.format(
|
||||||
libphonenumber.parse(number),
|
parsed,
|
||||||
libphonenumber.PhoneNumberFormat.INTERNATIONAL
|
libphonenumber.PhoneNumberFormat.INTERNATIONAL
|
||||||
));
|
));
|
||||||
this.selectStep(4);
|
this.selectStep(4);
|
||||||
|
|
Loading…
Reference in a new issue