From bc03f1eb92144f561469987fb4e25fb1d3079e8e Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 31 Jan 2022 10:51:49 -0500 Subject: [PATCH] approved_domains unproxied --- lib/registration.rb | 5 +++-- test/test_registration.rb | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/registration.rb b/lib/registration.rb index 79230d8..e5db85e 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -34,10 +34,11 @@ class Registration class Activation def self.for(customer, tel) + jid = ProxiedJID.new(customer.jid).unproxied if customer.active? Finish.new(customer, tel) - elsif CONFIG[:approved_domains].key?(customer.jid.domain.to_sym) - credit_to = CONFIG[:approved_domains][customer.jid.domain.to_sym] + elsif CONFIG[:approved_domains].key?(jid.domain.to_sym) + credit_to = CONFIG[:approved_domains][jid.domain.to_sym] Allow.new(customer, tel, credit_to) else new(customer, tel) diff --git a/test/test_registration.rb b/test/test_registration.rb index f76cb4d..06ee38a 100644 --- a/test/test_registration.rb +++ b/test/test_registration.rb @@ -55,12 +55,15 @@ class RegistrationTest < Minitest::Test def test_for_not_activated_approved sgx = OpenStruct.new(registered?: false) web_manager = TelSelections.new(redis: FakeRedis.new) - web_manager.set("test@approved.example.com", "+15555550000") + web_manager.set("test\\40approved.example.com@component", "+15555550000") iq = Blather::Stanza::Iq::Command.new iq.from = "test@approved.example.com" result = execute_command(iq) do Registration.for( - customer(sgx: sgx, jid: Blather::JID.new("test@approved.example.com")), + customer( + sgx: sgx, + jid: Blather::JID.new("test\\40approved.example.com@component") + ), web_manager ) end -- 2.45.2