简体   繁体   中英

Devise skip_confirmation! method confirms user

In my Ruby on Rails application I have multi step with wicked gem to create customer registration. I want to send confirmation at the last step so in my controller I use devise method:

@customer.skip_confirmation!

But this method is not sending confirmation email and automatically confirm customer. I don't want to have confirmed customer when he didn't click the link in mail. Is there any way to solve this problem?

There is a good answer here:

Rails 3 with Devise for Authentication - How do I manually create a user?

It explains that skip_confirmation! method sets confirmed_at , and also supplies a workaround which allows you to skip confirmation without confirming the user.

If you don't want confirmation to be sent on create, neither a code to be generated, call skip_confirmation!

if you have added in your user.rb (model) the confirmable module, than the confirmation will be send by it self, right after the user have been created. So you don't need to add something in your controller other than @user.create!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM