~singpolyma/sgx-jmp

7e4d61d77027df075ac9de12184df915c57c42b0 — Christopher Vollick 3 years ago 1e8eef2
Fix Invites with Empty Guard

Turns out every user will start with no attempts, and the code wasn't
handling that case. Oops.
2 files changed, 2 insertions(+), 2 deletions(-)

M lib/registration.rb
M test/test_registration.rb
M lib/registration.rb => lib/registration.rb +1 -1
@@ 376,7 376,7 @@ class Registration

			def guard_too_many_tries
				REDIS.get("jmp_invite_tries-#{@customer.customer_id}").then do |t|
					raise Invalid, "Too many wrong attempts" if t > 10
					raise Invalid, "Too many wrong attempts" if t.to_i > 10
				end
			end


M test/test_registration.rb => test/test_registration.rb +1 -1
@@ 354,7 354,7 @@ class RegistrationTest < Minitest::Test
				customer = Customer.new("test", plan_name: "test_usd")
				Registration::Payment::InviteCode::REDIS.expect(
					:get,
					EMPromise.resolve(0),
					EMPromise.resolve(nil),
					["jmp_invite_tries-test"]
				)
				Registration::Payment::InviteCode::COMMAND_MANAGER.expect(