An AuthLogic form is giving me incorrect validation errors -- why?
Posted
by sscirrus
on Stack Overflow
See other posts from Stack Overflow
or by sscirrus
Published on 2010-05-23T04:11:21Z
Indexed on
2010/05/23
4:20 UTC
Read the original article
Hit count: 300
Hi everyone,
I set up AuthLogic for Rails according to the AuthLogic example: http://github.com/binarylogic/authlogic_example.
I can log on successfully to the system, but when accessing users/new.html.erb to register a new user, the form returns the following validation errors:
Email is too short (minimum is 6 characters)
Email should look like an email address.
Login is too short (minimum is 3 characters)
Login should use only letters, numbers, spaces, and .-_@ please.
Password is too short (minimum is 4 characters)
Password confirmation is too short (minimum is 4 characters)
None of these errors exist in the data I am entering.
# new.html.erb
<%= form.label :login, nil, :class => "label" %><br />
<%= form.text_field :login, :class => "inputBox",
:name => "login", :type => "text" %><br />
<%= form.label :password, form.object.new_record? ? nil : "Change password", :class => "label" %><br />
<%= form.password_field :password, :class => "inputBox",
:name => "password", :type => "text" %><br />
<%= form.label "Confirm password", nil, :class => "label" %><br />
<%= form.password_field :password_confirmation, :class => "inputBox",
:name => "password_confirmation", :type => "text" %><br />
<%= form.label :email, nil, :class => "label" %><br />
<%= form.text_field :email, :class => "inputBox",
:name => "email", :type => "text" %><br />
# Users controller
def new
@user = User.new
render :layout => "forms"
end
I think the problem is that the data isn't being transferred somehow and therefore AuthLogic doesn't think the inputs are sufficient. Do you have any idea why AuthLogic is telling me the data doesn't satisfy its validation?
© Stack Overflow or respective owner