“电子邮件已经被占用”用户登录client_side_validations和devise时出错 [英] "Email is already taken" error when user logs in with client_side_validations and devise

查看:194
本文介绍了“电子邮件已经被占用”用户登录client_side_validations和devise时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的Rails应用程序中使用client_side_validations和devise,并在登录表单中获得一个奇怪的错误。



这是说电子邮件已经被取消,不允许用户登录:)
电子邮件用作登录。



只有当我设置:validate = >真的。
当我关闭设置:validate => true,登录成功执行。



可能会导致此问题?

解决方案

我得到了client_side_validations的作者的答案:



对于登录表单,你不想有唯一性验证器。因此,您需要执行以下操作:

  f.text_field:email,:validate => {:uniqueness => false} 

由于我所理解的是由于在devise中进行条件验证的解决方法。 / p>

I am trying to use both client_side_validations and devise in my Rails app, and get a weird bug in the log in form.

It's says that the email has already been taken and doesn't let the user to log in :) Email is used as the login.

This is only when I set the :validate => true. When I turn off the setting :validate => true, the log in is performed successfully.

What might cause this problem?

解决方案

I got the answer from the author of the client_side_validations:

For login form you don't want to have the uniqueness validator. So you'll need to do something like:

f.text_field :email, :validate => { :uniqueness => false }

From what I've understood this is the workaround because of the conditional validations in devise.

这篇关于“电子邮件已经被占用”用户登录client_side_validations和devise时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆