告知AuthLogic不使用密码确认

时间:2010-07-18 14:20:06

标签: ruby-on-rails authlogic user-experience password-confirmation

我有这个观点:

new.html.haml

%h1 New account

- form_for @user do |f|
  = f.error_messages
  = render :partial => "form", :object => f
  = f.submit "Create account"

_form.html.haml

= form.label :email
= form.text_field :email
%br/
= form.label :password, form.object.new_record? ? nil : "Change password"
= form.password_field :password

导致此恶意错误消息:

  

1错误禁止此用户被保存

     

以下字段存在问题:

     
      
  • 密码确认太短(最少4个字符)
  •   

我不想要密码确认。密码确认很糟糕,他们阻止超快速注册,这太棒了!任何人都可以解释我如何禁用密码确认?感谢。

1 个答案:

答案 0 :(得分:12)

试试这个:

class User < ActiveRecord::Base
  acts_as_authentic do |c|
    c.require_password_confirmation = false
  end
end

有关详细信息,请参阅documentation