设计 - 如何更改设置以便电子邮件地址不需要是唯一的 [英] Devise - how to change setting so that email addresses don't need to be unique

查看:27
本文介绍了设计 - 如何更改设置以便电子邮件地址不需要是唯一的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Devise 设置为使用用户名而不是电子邮件地址登录,因为我们的大量用户与其配偶共享相同的电子邮件地址.这是我们服务的独特市场.但每个配偶都需要单独的账户来记录性格测试结果.

I set up Devise to log in with a username instead of email address because a significant number of our users share the same email address with their spouse. It is a unique market that we serve. But each spouse needs separate accounts to record personality instrument results.

数据库不再需要唯一的电子邮件地址,因此它将为两个帐户接受相同的电子邮件地址.但是,Devise 仍然要求每个帐户都有一个唯一的电子邮件地址.有什么设置或变通办法可以用来改变这种情况吗?

The database no longer requires a unique email address so it will accept the same email addy for two accounts. However, Devise is still requiring a unique email address for each account. Is there a setting or a work around that i can use to change this?

推荐答案

查看config/initializers/devise.rb.您可以将默认身份验证密钥(默认为 :email)更改为您想要的任何内容,例如:

Look in the config/initializers/devise.rb. You can change the default authentication key, which by default is :email to be anything you want, for example:

config.authentication_keys = [ :username ]

这篇关于设计 - 如何更改设置以便电子邮件地址不需要是唯一的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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