只允许特定的电子邮件在Rails应用(Devise)中注册 [英] Allow only specific emails to register in Rails app (Devise)

查看:174
本文介绍了只允许特定的电子邮件在Rails应用(Devise)中注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Devise在Rails应用中验证和注册用户。但是,我只希望具有特定结尾的电子邮件的用户能够注册并访问它(假设@ xyz.com)。我需要做些什么来反映出来?

I am using Devise to authenticate and register users in my Rails app. However, I only want users who have an email with a specific ending to be able to sign up and access it (let's say @xyz.com). What do I need to do to reflect that?

推荐答案

Devise提供验证电子邮件地址的方法。
查看文档:

Devise offers a way to validate email addresses. Take a look to the documentation:

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

这篇关于只允许特定的电子邮件在Rails应用(Devise)中注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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