加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 告知AuthLogic不使用密码确认

发布时间:2020-12-17 04:03:26 所属栏目:百科 来源:网络整理
导读:我有这个观点: 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
我有这个观点:

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 error prohibited this user from being saved

There were problems with the following fields:

  • Password confirmation is too short (minimum is 4 characters)

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

解决方法

试试这个:

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

有关更多详细信息,请参阅documentation.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读