plataformatec/devise — pull request #3013 by aditya-kapoor (2014-05-05 08:36:57+00:00)
Title: Split send_reset_password_instructions for better hooking

Earlier, when we used to customize the recoverable module of the Devise, we need to override both the reset_password_token generation logic and the email sending logic in the same function i.e. `send_reset_password_instructions`.
Now, consider a use case where we want to generate the random link for our users and send the SMS instead of an email to the user. If we were to override the `send_reset_password_instructions` then we have to use the `reset_password_token` generation logic as it is and the email sending logic needs to be replaced with the SMS sending one. The principle of DRY is violated here. So here, I suggest the splitting up of the `send_reset_password_instructions` into two methods namely `set_reset_password_token` and `send_reset_password_instruction_notification`.

The `set_reset_password_token` is responsible for the generation and setting of the `reset_password_token` of the user. The `send_reset_password_instruction_notification` is responsible for the delivery of the email.
You can override the `set_reset_password_token` if you want to customize the reset_password_token generation and setting logic. Similarly, you can override the `send_reset_password_instruction_notification` for sending the SMS or changing Email sending logic.