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?

3
  • 1
    This sounds familiar to me but my memory isn't jarred... Perhaps you can post your migration, and controller/model/view for logins? Commented Sep 25, 2009 at 2:40
  • I second SingleShot's statement. Commented Sep 25, 2009 at 4: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? Commented Sep 25, 2009 at 10:22

4 Answers 4

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

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

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

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.