配置设计允许多个帐户使用相同的电子邮件 [英] Configure Devise Allow Same Email For Multiple Accounts

查看:62
本文介绍了配置设计允许多个帐户使用相同的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些用户希望对多个帐户使用相同的电子邮件地址。我们的rails应用程序使用omniauth-twitter gem和Devise来对用户进行身份验证。用户注册时,电子邮件是必需的,但不会用于身份验证。

We have users that want to use the same email address for multiple accounts. Our rails app uses omniauth-twitter gem with Devise to authenticate users. When users sign up, email is required but it is not used for authentication.

我们如何配置Devise,以允许用户在注册多个帐户时使用相同的电子邮件,而不会出现电子邮件已被占用的验证错误?

How do we configure Devise to allow users to use same email when signing up for multiple accounts without getting "email has already been taken" validation error?

推荐答案

您只需从模型设计选项中删除:validatable。

You can simply remove :validatable from the model devise options.


Validatable为用户电子邮件和
密码创建所有必需的验证。由于您可能要自己创建验证
,因此它是可选的。自动验证电子邮件是否存在,唯一的
及其格式是否有效。还测试密码的存在,确认
和长度。

Validatable creates all needed validations for a user email and password. It's optional, given you may want to create the validations by yourself. Automatically validate if the email is present, unique and its format is valid. Also tests presence of password, confirmation and length.

http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Validatable

这篇关于配置设计允许多个帐户使用相同的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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