TheOdinProject / theodinproject

Main Website for The Odin Project
http://www.theodinproject.com
MIT License
3.55k stars 2.06k forks source link

Feature: Admin v2 - reset team member passwords #4590

Closed KevinMulhern closed 2 days ago

KevinMulhern commented 3 days ago

Because:

This commit

Asartea commented 2 days ago

This might just be an unfortunate result from the review app not having an email provider, but clicking the button on the review app tries to POST to https://odin-review-app-pr-4590.herokuapp.com/admin_v2/team_members/1/password_resets and then returns a 500 Testing locally - this is definitely caused by something in the review app; works fine on localhost

Asartea commented 2 days ago

Testing locally:

Request data: _method "put" authenticity_token "C7ETjvK4bY19EUWBYLv_zp9waXgvgodwKho7uJ07cIE56nncTeZlXlsHGZuKjsC54TQntHDs3YdRPZmeIcujsQ" admin_user[reset_password_token] "vgsHmpEY8q6x8XEUp_7R" admin_user[password] "testpassword123" admin_user[password_confirmation] "testpassword123" commit "Change+my+password"

KevinMulhern commented 2 days ago

Thanks for the feedback @Asartea 💪

I've not been able to reproduce the 422 with those steps so far. I've tried with pending/active users, different combos of passwords and deliberately failing validations and then entering a valid password. Is there anything else you can think of that you did different?

KevinMulhern commented 2 days ago

I think I've found it. 422 responses happen when the password reset token is no longer valid. I've been able to reproduce that in a couple of ways:

It's somewhat of an edgecase. But you're right, we should provide feedback when it happens. I've updated the branch to include an error message.

Great spot 🚀

KevinMulhern commented 2 days ago

Note: This can't be tested on the review app but can be tested locally. We don't have an email provider available on review apps.

Steps for QA:

  1. Log into admin v2 - admin@odin.com, password123
  2. Invite a new team member
  3. Click the ellipsis menu on the new team member
  4. Click the "Send password reset email" option
  5. Open the password reset link in an incognito window
  6. Choose a new password
  7. You should be logged in and redirected to the admin v2 dashboard as the new team member
Asartea commented 2 days ago

I think I've found it. 422 responses happen when the password reset token is no longer valid. I've been able to reproduce that in a couple of ways:

Yeah, it was probably one of these.

QA

  1. works as expected
  2. image
  3. image
  4. image image
  5. image
  6. (and 7) image

Trying to submit two different passwords: image

And just to check the previous issue: image

Overall: LGTM :rocket: