R – Authlogic Password is not valid error

authlogicpasswordsruby-on-rails

I'm getting a similar error to this post Ruby on Rails Authlogic password not valid "Password is not valid" which never seemed to be resolved

in the script/console if I create a new user:

myval = "foo@example.com"
u = User.create(:email => myval, :password => myval, :password_confirmation => myval)
u.valid? 
>> true
u.save
>> true
u.valid_password?(myval)
>>false

if i set in my user.rb:

acts_as_authentic  do |c|
   c.validate_password_field = false
end

i get the same response. Any suggestions?

Best Answer

I just took a dig through the AuthLogic code and it looks like setting validate_password_field to false only prevents Rails from running the default validations. It has no effect on the valid_password? method.

There are a number of other factors that appear to cause it to return false. These include but may not be limited to:

  • Checking for a blank password
  • The crypted password is blank
  • The password doesn't match. (This one is a bit complicated because there are a variety of factors involved in this, including the CryptoProvider and whether or not you're using RestfulAuthentication style passwords.)

To give a more definitive answer, I probably need some more information on your exact setup.

Related Topic