使用Security Extension for Devise(RoR)注册时出现错误"邮件已被采取"两次

Con*_*hen 5 ruby-on-rails devise

我正在使用具有安全扩展的设计来验证强密码.

当我尝试使用已经收到的电子邮件注册帐户时,我在错误哈希中收到错误"已经收到电子邮件"两次.

我的用户模型如下所示:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  # :trackable deleted
  devise :database_authenticatable, :registerable, :secure_validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :firstname, :lastname, :password, :password_confirmation, :remember_me
end
Run Code Online (Sandbox Code Playgroud)

如果没有安全扩展(:validatable而不是:secure_validatable),我只会得到一次错误.

我究竟做错了什么?


PS奖金问题:

如何防止首先出现某些错误?我是否必须操纵设计的RegistrationsController或者有一个选项吗?

And*_*isu 5

有同样的问题.

检查这是否有帮助:https://groups.google.com/forum/?fromgroups =#!topic/platforma- devise/S0nxv7BK10M

  • 谢谢!对于那些无法访问该链接的用户(例如,在中国或伊朗的任何人),如果您使用validateatable模块,然后将自己的状态验证添加到电子邮件字段,则会看到此问题。这将意味着您有两个电子邮件验证。 (2认同)