yev2000/myflix — pull request #8 by yev2000 (2014-11-13 21:10:32+00:00)
Title: Email Generation and Password Reset

This constitutes the implementation for two key features:
1 -- Generating an email notification for a user who creates a new account. For this work, I diverged a little from the solution by choosing to create a multi-part email which contains both HTML and text content. So the verifiers in the tests had to be slightly different in order to find the right content in the message.part components rather than message.body.

2 - Implementing the password reset features. I diverged a bit from the solution by keeping the code in the forgot_password controller rather than creating two controllers. Also there is a difference in my approach because for the password reset form, I chose to use bootstrap_form_for(@user). In the solution, Kevin creates a form that is not tied to the model. I chose to actually made a form for the @user because it would allow me to take advantage of display of validation errors in the form (such as when the user did not enter a password that was long enough in characters, or if the password confirmation field did not match the password field). In order to make this work, I had to experiment and figure out to use the ' as: "" ' argument to the bootstrap_form_for() because that is what allowed me to get the query parameters for the new password to live at the top-level of params, rather than being subordinate to :user.

Also as part of this work and related to the email generation, I made use of the Figaro gem to allow for environment settings management in application,yml to keep sensitive credential data out of the code repository. You will see references to that since I made use of the ENV[] construct to get the account/password settings for email generation which are in turn set by Figaro at startup.