-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Devise use find_for_database_authentication for finding the user which make it easy to support additional attributes like if we want to have single login field when I am using username and emails.
Would be great if token auth used find_for_database_authentication rather than doing it's own find.
@lynndylanhurley Let me know if you are open to it I will send in a pull request
in the meantime, if anyone else is looking to do the same, here is a quick hack overriding wherein User model.
def self.where(*args)
# override for devise-token auth
if args.length == 2 && args[0] == "login = ? AND provider='email'"
where(['lower(username) = :value OR lower(email) = :value', { value: args[1] }])
else
super
end
end
mdsjs