FIX: only allow one user to be created per invite
This commit is contained in:
parent
458b9c3a62
commit
67357b84b9
|
@ -11,7 +11,7 @@ InviteRedeemer = Struct.new(:invite, :username, :name, :password, :user_custom_f
|
|||
# If `invite_passthrough_hours` is defined, allow them to re-use the invite link
|
||||
# to login again.
|
||||
if invite.redeemed_at && invite.redeemed_at >= SiteSetting.invite_passthrough_hours.hours.ago
|
||||
return invited_user
|
||||
return get_existing_user
|
||||
end
|
||||
|
||||
nil
|
||||
|
|
|
@ -128,5 +128,18 @@ describe InviteRedeemer do
|
|||
expect(user.group_users.count).to eq(4)
|
||||
expect(user.trust_level).to eq(2)
|
||||
end
|
||||
|
||||
it "only allows one user to be created per invite" do
|
||||
SiteSetting.invite_passthrough_hours = 4800
|
||||
user = invite_redeemer.redeem
|
||||
invite.reload
|
||||
|
||||
user.email = "john@example.com"
|
||||
user.save!
|
||||
|
||||
another_invite_redeemer = InviteRedeemer.new(invite, username, name)
|
||||
another_user = another_invite_redeemer.redeem
|
||||
expect(another_user).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue