49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/devise/multi_email/models/authenticatable.rb', line 49
def find_first_by_auth_conditions(tainted_conditions, opts = {})
filtered_conditions = devise_parameter_filter.filter(tainted_conditions.dup)
email = filtered_conditions.delete(:email)
if email && email.is_a?(String)
conditions = filtered_conditions.to_h.merge(opts).
reverse_merge(multi_email_association.reflection.table_name => { email: email })
resource = joins(multi_email_association.name).find_by(conditions)
resource.current_login_email = email if resource.respond_to?(:current_login_email=)
resource
else
super(tainted_conditions, opts)
end
end
|