danfstucky / LeagueSpec

Rails application for League of Legends statistics
1 stars 0 forks source link

Account Activation and Password Reset #19

Closed danfstucky closed 8 years ago

danfstucky commented 8 years ago

@sl7v3 @jwiebe17 This branch requires accounts to be activated by verifying an email address and also allows users to reset passwords. In both cases, the app sends an email to the user. This isnt fully allowed in development environment however so you will not actually receive an email at the given address, but all the important code is here and can be tested to mock the real thing.

Steps to reproduce: Whenever you signup a new account you will be notified that you need to activate it. Activating an account requires visiting a link inside an email. For a dev environment, you can find this link inside your terminal after you create the account. It will be something similar to localhost:3000/account_activations/BXwekqKg4BPDKKK5p9NC4Q/edit?email=example1%40example.com. Copy paste your link into the browser and you will be notified that your account has been activated. The process is very similar for resetting a password.

You can also preview the emails that are sent here: Account Activation: http://localhost:3000/rails/mailers/user_mailer/account_activation PW Reset: http://localhost:3000/rails/mailers/user_mailer/password_reset

Email previewing for a dev environment is made possible by the test/mailers/previews/user_mailer_preview.rb class and you can find the above links commented into that class as well.

Just to clarify, this only completely works in the dev environment. We don't actually even have a production environment yet, but for it to work in prod a few more things will need to be added in the future.

sulaimonlasisi commented 8 years ago

I tried following steps to reproduce by copying this to the browser: localhost:3000/account_activations/BXwekqKg4BPDKKK5p9NC4Q/edit?email=example1%40example.com and I got a no routes matches page. I changed the email=part to an email I signed up with and it led to a profile page but the flash message on that page said "Invalid activation link", I think that should say "Email activation successful" I also tried visiting "http://localhost:3000/rails/mailers/user_mailer/account_activation" for activation and the flash message on the profile page also said "Invalid activation link".

For the password reset link: http://localhost:3000/rails/mailers/user_mailer/password_reset, the error I got after clicking on password reset was: NoMethodError in PasswordResetsController#edit

Are these due to it being a dev environment or are there a few pieces that still need to be working?

sulaimonlasisi commented 8 years ago

@danfstucky Did you respond to this earlier? I thought I saw a response from you but now that I wanted to test according to your response, I couldn't find the response steps.

danfstucky commented 8 years ago

@sl7v3 I had a lengthy response so I wrote it on slack.

sulaimonlasisi commented 8 years ago

Email activation reset works. Password reset errs with a message that signals a typo. Line 56 of password_reset_controller spells redirect as redirecto. Once I fixed this, it passed. You should fix that typo and then it's good to merge. +~1

danfstucky commented 8 years ago

@sl7v3 Good catch! Made the fix. Gonna go ahead and merge

danfstucky commented 8 years ago

Merged here: https://github.com/danfstucky/LeagueSpec/commit/2a5d9852f983dcaf9a08c5e7edd39c049b337d30