From 3b1b00a869a050c09637bc8f245c9d71360b9aa8 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Sun, 9 Jul 2017 19:54:35 +0530 Subject: [PATCH] FIX: invited user should not be able to redeem invite as admin --- app/models/invite_redeemer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/invite_redeemer.rb b/app/models/invite_redeemer.rb index 3a3e304dab8..df748bf32bc 100644 --- a/app/models/invite_redeemer.rb +++ b/app/models/invite_redeemer.rb @@ -19,7 +19,7 @@ InviteRedeemer = Struct.new(:invite, :username, :name, :password, :user_custom_f # extracted from User cause it is very specific to invites def self.create_user_from_invite(invite, username, name, password=nil, user_custom_fields=nil) - user_exists = User.find_by_email(invite.email) + user_exists = User.where(admin: false).find_by_email(invite.email) return user if user_exists if username && UsernameValidator.new(username).valid_format? && User.username_available?(username)