Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creates a new sessionToken when updating password #2266

Merged
merged 2 commits into from
Jul 13, 2016
Merged

Conversation

flovilmart
Copy link
Contributor

@flovilmart flovilmart commented Jul 13, 2016

When upgrading a user from anonymous to username/password the original implementation would force the client to call login in order to generate a session token.

This PR attempts to fix that problem by generating a new session token after clearing the sessions.

Fixes #2252

// Session token should have changed
expect(user.sessionToken).not.toEqual(originalSessionToken);
// test that the sessionToken is valid
return new Promise((resolve, reject) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We have request-promise now if you want to avoid some boilerplate in later PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's helpful. I'll update

@drew-gross
Copy link
Contributor

Can you add a test that verification email is sent when upgrading to non-anon and setting email? Also, postgres tests are failing, we may need to add another exclude.

@flovilmart
Copy link
Contributor Author

Yup!

@ghost
Copy link

ghost commented Jul 13, 2016

@flovilmart updated the pull request.

1 similar comment
@ghost
Copy link

ghost commented Jul 13, 2016

@flovilmart updated the pull request.


it_exclude_dbs(['postgres'])('should send email when upgrading from anon', (done) => {

let emailCalled = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

You might find jasmine spies more convenient. This is fine here though.

@flovilmart flovilmart merged commit 32f7230 into master Jul 13, 2016
@flovilmart flovilmart deleted the issue-2252 branch August 20, 2016 20:06
rsouzas pushed a commit to back4app/parse-server that referenced this pull request Mar 15, 2017
* Creates a new sessionToken when updating password

* Adds test ensuring email is properly sent when upgrading from anon
rsouzas pushed a commit to back4app/parse-server that referenced this pull request Mar 16, 2017
* Creates a new sessionToken when updating password

* Adds test ensuring email is properly sent when upgrading from anon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot create a username/password user from an anonymous user
2 participants