4

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?

irl_irl
  • 3,785
  • 9
  • 49
  • 60
  • 1
    This sounds familiar to me but my memory isn't jarred... Perhaps you can post your migration, and controller/model/view for logins? – SingleShot Sep 25 '09 at 02:40
  • I second SingleShot's statement. – khelll Sep 25 '09 at 04:12
  • What makes you so sure your password is valid? Obviously it isn't. That is, some validation is adding errors. Are you aware of the built-in default validations in authlogic, for example? – August Lilleaas Sep 25 '09 at 10:22

4 Answers4

4

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

Graeme Worthy
  • 228
  • 2
  • 4
1

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

epid
  • 153
  • 5
1

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

Mark Kenny
  • 1,598
  • 2
  • 17
  • 30
0

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 :)

marrossa
  • 708
  • 6
  • 9