Authlogic Password confirmation is too short Error. NEED HELP.

Hi:

I am using authlogic, and following railscast tutorial. I am running into this error code with the password confirmation.

authlogic password confirmation is too short

Has anyone experienced this error? I need your help.

Thanks in advance for your help.

about2flip wrote:

Hi:

I am using authlogic, and following railscast tutorial. I am running into this error code with the password confirmation.

authlogic password confirmation is too short

Has anyone experienced this error? I need your help.

Thanks in advance for your help.

Configure Authlogic with a different minimum password length (check the rdoc for details).

Best,

Hi:

I read through the rdocs, and I saw the following:

def require_password_confirmation(value = nil)   rw_config(:require_password_confirmation, value, true) end

def validates_length_of_password_field_options(value = nil)   rw_config(:validates_length_of_password_field_options, value, {:minimum => 4, :if => :require_password?}) end

def validates_length_of_password_confirmation_field_options(value = nil)   rw_config(:validates_length_of_password_confirmation_field_options, value, validates_length_of_password_field_options) end

i put these into my ApplicationController, and it does not seem to be working. It still tells me that my password confirmation is too short. I am pulling out my hair.

Any help would be greatly appreciated. Also, I am on XP OS.

Thanks Again

Then that's probably because it's zero-length because you're not actually passing anything. Typo in login form, maybe?

Have you put any debugging statements in your controller to show the value for password confirmation that you think you're using?

Hi:

I read through the rdocs, and I saw the following:

def require_password_confirmation(value = nil) rw_config(:require_password_confirmation, value, true) end

def validates_length_of_password_field_options(value = nil) rw_config(:validates_length_of_password_field_options, value, {:minimum => 4, :if => :require_password?}) end

def validates_length_of_password_confirmation_field_options(value = nil) rw_config(:validates_length_of_password_confirmation_field_options, value, validates_length_of_password_field_options) end

i put these into my ApplicationController, and it does not seem to be working. It still tells me that my password confirmation is too short. I am pulling out my hair.

These don't go in your ApplicationController... they go into the model
that you are applying AuthLogic on. The below would change the
minimum to 1 character.

class User < ActiveRecord::Base    acts_as_authentic do |c|        c .merge_validates_length_of_password_confirmation_field_options   :minimum => 1    end end

Unless you have a good reason though requiring at least 4 characters
isn't unreasonable (some would argue you should require more).

-philip

I don't require max 4. It is doing it automatically, which is why I am getting pissed off. I don't have anything set stating that max is 4.

I tried what you suggested, and now it's telling me that password is too short minimum 1. I am putting in 4,5,6 characters. I also put in this:

merge_validates_confirmation_of_password_field_options

What are the options, I don't see them in rdoc.

Thanks.

Would it be because of this line in my model:

attr_accessible :username, :email, :password

thanks

Would it be because of this line in my model:

attr_accessible :username, :email, :password

yes - this means that

User.create(params[:user]) won't set username, email or password.

Fred

Well I think I fixed it because I see my data saved to the DB table. I just added this:

attr_accessible :username, :email, :password, :password_confirmation

but I got a controller error:

undefined local variable or method `root_url' for #<UsersController: 0x477b998>

will try to figure out.

Thanks to all that replied and helped

Well I think I fixed it because I see my data saved to the DB table. I just added this:

attr_accessible :username, :email, :password, :password_confirmation

Sorry I got things the wrong way round - attr_accessible means that
User.new(params[:user]) will assign them, however when you use
attr_accessible any attribute you don't name is implicitly made
attr_protected (which is the thing where they aren't mass assigned).

Fred