From 429ca1bbbdf95853082707942c2bb73e5a2e4577 Mon Sep 17 00:00:00 2001 From: Ami Mahloof Date: Mon, 8 Apr 2024 16:34:24 -0400 Subject: [PATCH] Fix phone regex for E164. --- lib/descope/mixins/common.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/descope/mixins/common.rb b/lib/descope/mixins/common.rb index 7311089..127b14a 100644 --- a/lib/descope/mixins/common.rb +++ b/lib/descope/mixins/common.rb @@ -9,7 +9,8 @@ module Common DEFAULT_BASE_URL = 'https://api.descope.com' # pragma: no cover DEFAULT_TIMEOUT_SECONDS = 60 DEFAULT_JWT_VALIDATION_LEEWAY = 5 - PHONE_REGEX = %r{^(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[-./ \\]?(?:(?:\(?\d{1,}\)?[-./ \\]?){0,})(?:[-./ \\]?(?:#|ext\.?|extension|x)[-./ \\]?(\d+))?$} + # Using E164 format,\A and \z are start and end of string respectively, to prevent multiline matching + PHONE_REGEX = /\A\+[1-9]\d{1,14}\z/ SESSION_COOKIE_NAME = 'DS' REFRESH_SESSION_COOKIE_NAME = 'DSR'