ruby on rails - authlogic "you did not provide any details for authentication" with email and password fields in form -
i above message when try login user created after logout...
my user model this, name display name
class user < activerecord::base attr_accessible :name, :email, :persistence_token, :password, :password_confirmation before_save { |user| user.email = email.downcase } validates :email, uniqueness: true acts_as_authentic |configuration| configuration.session_class = session end end
my migration
class createusers < activerecord::migration def self.up create_table :users |t| t.string :email t.string :name t.string :crypted_password t.string :password_salt t.string :persistence_token end end def self.down drop_table :sessions end end
and use :email
, :password
fields login form
you should set login_field
parameter :email, because default :username or :login field:
class user < activerecord::base #... acts_as_authentic |configuration| configuration.session_class = session configuration.login_field = :email end end
in user
model downcase email before save, if want seach case insensitive email in db, should implement find_by_login_method
:
class session < authlogic::session::base find_by_login_method :find_by_downcase_email end class user < activerecord::base #... def self.find_by_downcase_email(login) find_by_email(login.downcase) end end
Comments
Post a Comment