app/forms/decidim/verifications/sms/mobile_phone_form.rb in decidim-verifications-0.18.1 vs app/forms/decidim/verifications/sms/mobile_phone_form.rb in decidim-verifications-0.19.0
- old
+ new
@@ -23,10 +23,11 @@
end
# When there's a phone number, sanitize it allowing only numbers and +.
def mobile_phone_number
return unless super
+
super.gsub(/[^\+0-9]/, "")
end
# The verification metadata to validate in the next step.
def verification_metadata
@@ -41,9 +42,10 @@
def verification_code
return unless sms_gateway
return @verification_code if defined?(@verification_code)
return unless sms_gateway.new(mobile_phone_number, generated_code).deliver_code
+
@verification_code = generated_code
end
def sms_gateway
Decidim.sms_gateway_service.to_s.safe_constantize