Using Devise, how can I send confirmation email (identical to signup email) on first password update (or on an action other than usual sign up)?
Asked
Active
Viewed 45 times
0
-
You can use the [after_confirmation](https://www.rubydoc.info/github/plataformatec/devise/Devise/Models/Confirmable:after_confirmation) devise method. Check this good example [here](https://stackoverflow.com/questions/36597212/devise-sending-welcome-email) – Sovalina May 08 '18 at 14:52
1 Answers
0
I did it by adding a condition to create
method in confirmations_controller.rb
def create
self.resource = resource_class.send_confirmation_instructions(resource_params)
yield resource if block_given?
if successfully_sent?(resource)
respond_with({}, location: after_resending_confirmation_instructions_path_for(resource_name))
else
if <condition> then
User.find_by_email(resource.email).send_confirmation_instructions
respond_with({}, location: after_resending_confirmation_instructions_path_for(resource_name))
else
respond_with(resource)
end
end
end

TamerB
- 1,401
- 1
- 12
- 27