Commit 9cec3e8d authored by Doug Stull's avatar Doug Stull

Merge branch 'prevent-redirect-loop-when-requiring-credit-card' into 'master'

Do not require a credit card verification on signup when it is already present

See merge request gitlab-org/gitlab!78910
parents bdb3acd5 75b2eba0
...@@ -19,6 +19,8 @@ module Registrations::Verification ...@@ -19,6 +19,8 @@ module Registrations::Verification
end end
def set_requires_verification def set_requires_verification
return if current_user.credit_card_validation.present?
::Users::UpdateService.new(current_user, user: current_user, requires_credit_card_verification: true).execute! ::Users::UpdateService.new(current_user, user: current_user, requires_credit_card_verification: true).execute!
end end
end end
......
...@@ -67,5 +67,15 @@ RSpec.describe Registrations::Verification do ...@@ -67,5 +67,15 @@ RSpec.describe Registrations::Verification do
it 'sets the requires_credit_card_verification attribute' do it 'sets the requires_credit_card_verification attribute' do
expect { get :new }.to change { user.reload.requires_credit_card_verification }.to(true) expect { get :new }.to change { user.reload.requires_credit_card_verification }.to(true)
end end
context 'when a credit card validation exists' do
before do
create(:credit_card_validation, user: user)
end
it 'does not change the requires_credit_card_verification attribute' do
expect { get :new }.not_to change { user.reload.requires_credit_card_verification }
end
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment