I'm using Devise to allow user signup as-well-as using my own user admin to create users manually. When I create a user in the admin, Devise sends a confirmation immediately to the new user. I believe this is due to the fact that both devise and my admin use the same model. How do I delay this email until the administrator is ready to send it?
Additionally, Devise's validation is requiring the admin set a password for the new user. I would much prefer the manually created users specify their own password when they respond the confirmation. Right now manually created users will not know their password unless I send it too them in a supplemental email.
@user.skip_confirmation! confirms the user, so the user can log in without using the confirmation.
This works for me in devise 3.5
Stop devise to send confirmation email while creating user.
@user.skip_confirmation_notification!
Send confirmation instructions later
@user.send_confirmation_instructions
We do this in one of our apps. You can tell Devise NOT to automatically deliver the confirmation like this:
@user.skip_confirmation!
And then later, you can do
Devise::Mailer.confirmation_instructions(@user).deliver
For Rails 2.x you'd do something like:
DeviseMailer.deliver_confirmation_instructions(@user)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With