FIX: invited user should not be able to redeem invite as admin
This commit is contained in:
parent
6af40a6ade
commit
3b1b00a869
|
@ -19,7 +19,7 @@ InviteRedeemer = Struct.new(:invite, :username, :name, :password, :user_custom_f
|
||||||
|
|
||||||
# extracted from User cause it is very specific to invites
|
# 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)
|
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
|
return user if user_exists
|
||||||
|
|
||||||
if username && UsernameValidator.new(username).valid_format? && User.username_available?(username)
|
if username && UsernameValidator.new(username).valid_format? && User.username_available?(username)
|
||||||
|
|
Loading…
Reference in New Issue