使用Devise创建新用户时跳过电子邮件确认 [英] Skip email confirmation when creating a new user using Devise

查看:156
本文介绍了使用Devise创建新用户时跳过电子邮件确认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用户注册页面,并将信息发送给一个新用户在网站上注册的几个管理用户。

I have a user registration page and will send the information to couple of admin users that one new user registered in the site.

现在,我创建了用户列表(200+)的种子数据。所以,它将发送200多个电子邮件给相应的管理员用户。因此,我想在创建新用户时停止向管理员发送邮件确认。

Now, I created the seed data with list of users (200+). So, It'll send the 200+ email to the respective admin users. Hence, I want to stop send the mail confirmation to admin users when creating new user.

推荐答案

对于Devise,添加 user.skip_confirmation!保存前。

For Devise, add user.skip_confirmation! before saving.

user = User.new(
    :email => 'person@example.com',
    :password => 'password1',
    :password_confirmation => 'password1'
  )
user.skip_confirmation!
user.save!

引用: https://github.com/plataformatec/devise/pull/2296

这篇关于使用Devise创建新用户时跳过电子邮件确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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