Question

I am trying to implement Authlogic. Registering is fine, it enters all the necessary details into my database..

.. but when I try to log in, it gives me the error:

1 error prohibited this user session from being saved

There were problems with the following fields:

Password is not valid

My password is valid. I am not sure what is happening. Any ideas?

Was it helpful?

Solution

I had the same problem, and it was because I was migrating from Restful authentication. The issue was: Restful authentication puts a 40 char cap on password-salt and crypted-password. the hashes generated by authlogic are larger than that.

class RemovePasswordSaltCap < ActiveRecord::Migration
  def self.up
    change_column :users, :password_salt, :string, :limit => nil
    change_column :users, :crypted_password, :string, :limit => nil
  end
end

Found this answer in the fine manual.

the fine manual

OTHER TIPS

In your user model, try this:

class User < ActiveRecord::Base

  acts_as_authentic do |c|
    c.validate_password_field = false
  end

end

Then try to log in again. If that works, then you will know that the authlogic default validations were tripping you up.

You can also try

valid_password?(attempted_password, check_against_database = check_passwords_against_database?)

with the console

I was getting the same error and my problem was that I wasn't using the REST_AUTH_SITE_KEY key value that I previously used with restful authentication.

I added the key value and everything works :)

If upgrading to authlogic the default crypto_provider has changed from Sha512 to SCrypt so it might be a case that passwords are broken. Check out the authlogic readme

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top