jeudi 21 décembre 2017

Rails Devise authentication with email and another field

Using rails with devise. On user table I have email and a field record_status. Record status will contain 'active' or 'deleted'

What do I need to change to authenticate using email and record_status = 'active'.

i have this code in place.

in my user model

def self.find_for_database_authentication(warden_conditions)
  status = 'active'
  where(:email => warden_conditions[:email], :record_status => warden_conditions[:status]).first
end

in my initializer devise.rb

config.case_insensitive_keys = [:email]

thanks for the help guys

Aucun commentaire:

Enregistrer un commentaire