From a8e1fb43bf82a57ee9c310d19f58f67692244366 Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 21 Jun 2023 09:29:12 +0100 Subject: [PATCH] Update valid_phone_number? --- app/controllers/users_controller.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 11a6c22da..32a135e36 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -127,13 +127,7 @@ private end def valid_phone_number?(number) - numeric?(number) && number.length >= 11 - end - - def numeric?(str) - !Float(str).nil? - rescue StandardError - false + /^\d{11,}$/.match?(number) end def format_error_messages