问题描述
我设置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?
推荐答案
查看配置/初始化/ 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]
这篇关于Devise - 如何更改设置,以便电子邮件地址不需要是唯一的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!