Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Fix session creation for auto-login when resetting password #465

Merged
merged 3 commits into from
Jul 22, 2016

Conversation

typerandom
Copy link
Contributor

Fixes so that a session cookie is created when web.changePassword.autoLogin is enabled and you're resetting the password for an account.

How to verify

  1. Create a new application using this gist.
  2. Start the application.
  3. Navigate to the forgot password page (http://localhost:3000/forgot) and reset the password for one of your accounts.
  4. Click the reset password link in the email you received and change the password for your account.
  5. You should be redirected to / and logged in.

Fixes #164

@coveralls
Copy link

coveralls commented Jul 10, 2016

Coverage Status

Coverage decreased (-0.5%) to 70.974% when pulling 684a71c on fix-password-reset-autologin into f1abe55 on master.

@robertjd
Copy link
Member

I've verified that this PR fixes the reported problem, however I'm also noticing that the pre/post handlers are not being run for this case. Can we refactor the code to handle those cases as well? I know it may touch many files, but it seems like we can consolidate a lot of this.

@coveralls
Copy link

coveralls commented Jul 14, 2016

Coverage Status

Coverage decreased (-0.4%) to 71.15% when pulling 860a79d on fix-password-reset-autologin into f1abe55 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 71.15% when pulling 860a79d on fix-password-reset-autologin into f1abe55 on master.

@typerandom
Copy link
Contributor Author

@robertjd The latest changes are now pushed.

@typerandom typerandom force-pushed the fix-password-reset-autologin branch from 860a79d to 7248ca7 Compare July 14, 2016 21:02
@coveralls
Copy link

coveralls commented Jul 14, 2016

Coverage Status

Coverage decreased (-0.4%) to 71.15% when pulling 7248ca7 on fix-password-reset-autologin into f1abe55 on master.

return done(err);
}

var preLoginHandlerFormData = fixture.preLoginHandlerFormData;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention of this test case is to assert that the developer can end the response inside of their preLoginHandler, and that their response will be the final one.

These modifications don't assert that code path anymore, because the preLoginHandlerInterceptResponseTestFixture has been modified to always call next(), so we aren't testing a custom response by the developer anymore. This test should be reverted back to it's original intent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see. I'll fix that!

@robertjd
Copy link
Member

Thanks @typerandom ! This looks great and I've verified that it solves the original issue.

I do have one issue with a test change, please see my inline comments. In sum: we need to make sure that we have a test case that asserts the developer's ability to end the response from inside their handler, preventing the rest of the next() handlers from running. I'd like to address this test issue before we merge.

@typerandom
Copy link
Contributor Author

@robertjd I saw your comment and I'll fix the code/test before we continue.

@typerandom typerandom force-pushed the fix-password-reset-autologin branch from 762273c to f7e0708 Compare July 22, 2016 13:41
@coveralls
Copy link

coveralls commented Jul 22, 2016

Coverage Status

Coverage decreased (-0.9%) to 70.661% when pulling f7e0708 on fix-password-reset-autologin into f1abe55 on master.

@typerandom
Copy link
Contributor Author

@robertjd This is fixed now.

@robertjd robertjd merged commit 16ad7ef into master Jul 22, 2016
@robertjd robertjd deleted the fix-password-reset-autologin branch July 22, 2016 18:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants