From e5c6541e6c14ed6cb3f7cf595c5704ca87177bb8 Mon Sep 17 00:00:00 2001 From: lilia Date: Sat, 7 Nov 2015 20:34:34 -0800 Subject: [PATCH] Validate number before showing step 4 // FREEBIE --- js/views/install_view.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/views/install_view.js b/js/views/install_view.js index 5ef7f97e..e3d706b0 100644 --- a/js/views/install_view.js +++ b/js/views/install_view.js @@ -26,8 +26,12 @@ new QRCode(this.$('#qr')[0]).makeCode(url); }, confirmNumber: function(number) { + var parsed = libphonenumber.parse(number); + if (!libphonenumber.isValidNumber(parsed)) { + throw new Error('Invalid number'); + } this.$('#step4 .number').text(libphonenumber.format( - libphonenumber.parse(number), + parsed, libphonenumber.PhoneNumberFormat.INTERNATIONAL )); this.selectStep(4);