-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix: Remove username from email verification and password reset process #8488
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
Merged
Merged
Changes from 23 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
78c67d4
fix: remove username from verification emails
dblythy 407825d
tests
dblythy 0c49a4a
feat: allow Pointers in cloud code params
dblythy 3d50b00
Revert "feat: allow Pointers in cloud code params"
dblythy 713e357
Merge branch 'alpha' into password-reset
dblythy f814457
wip
dblythy b960a1a
Update ValidationAndPasswordsReset.spec.js
dblythy 9f3808a
Merge remote-tracking branch 'upstream/alpha' into password-reset
dblythy 9d4a028
Update UserController.spec.js
dblythy 7252893
fix failing tests
dblythy f9b54dd
Update UserController.js
dblythy 4a72e2e
fix tests
dblythy e110732
Update ValidationAndPasswordsReset.spec.js
dblythy 5beb30f
Update ValidationAndPasswordsReset.spec.js
dblythy 205d59e
Update UserController.spec.js
dblythy db5409a
fix failing tests
dblythy 170f83a
add logging
dblythy 6ff9e6b
Update CurrentSpecReporter.js
dblythy e1ed76b
revert resolve
dblythy 0d8a4a2
add catch
dblythy 493fcf2
Merge branch 'alpha' into password-reset
dblythy 0cb359a
Merge branch 'alpha' into password-reset
mtrezza 3295166
Create 8.0.0.md
dblythy 4808c8a
fix pages router
dblythy c09bc87
Merge branch 'alpha' into password-reset
mtrezza d60bbd2
review feedback
dblythy e6b67ed
Update 8.0.0.md
mtrezza 780bc48
Update 8.0.0.md
mtrezza 42a2ff5
Update 8.0.0.md
mtrezza a32d0e6
Update 8.0.0.md
mtrezza ae6ac40
Merge branch 'alpha' into password-reset
mtrezza e75113c
Update 8.0.0.md
mtrezza 02069d9
Update 8.0.0.md
dblythy 280984f
Update 8.0.0.md
mtrezza e0e094c
Merge branch 'alpha' into password-reset
mtrezza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Parse Server 8 Migration Guide <!-- omit in toc --> | ||
|
||
This document highlights specific changes that require a longer explanation. For a full list of changes in Parse Server 8, please refer to the [changelog](https://github.com/parse-community/parse-server/blob/alpha/CHANGELOG.md). | ||
|
||
--- | ||
|
||
- [Invalid Link Page Changes](#invalid-link-page-changes) | ||
|
||
--- | ||
|
||
## Invalid Link Page Changes | ||
|
||
In Parse Server 8, the invalid link page will no longer provide the `username` URL parameter. Instead, the URL parameter will now be `expiredToken`. This change affects how expired verification emails are handled. | ||
dblythy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Regenerating a Verification Email Request | ||
|
||
To regenerate a verification email request, send a `POST` request to the following endpoint: | ||
|
||
``` | ||
HTTP | ||
Method: POST | ||
URL: {{server url}}/resend_verification_email | ||
|
||
Headers: | ||
Content-Type: application/x-www-form-urlencoded | ||
|
||
Body: | ||
expiredToken={token} | ||
``` | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ describe('Email Verification Token Expiration: ', () => { | |
}).then(response => { | ||
expect(response.status).toEqual(302); | ||
expect(response.text).toEqual( | ||
'Found. Redirecting to http://localhost:8378/1/apps/invalid_verification_link.html?username=testEmailVerifyTokenValidity&appId=test' | ||
`Found. Redirecting to http://localhost:8378/1/apps/invalid_verification_link.html?appId=test&expiredToken=${sendEmailOptions.link.split('token=')[1]}` | ||
); | ||
done(); | ||
}); | ||
|
@@ -135,7 +135,7 @@ describe('Email Verification Token Expiration: ', () => { | |
}).then(response => { | ||
expect(response.status).toEqual(302); | ||
expect(response.text).toEqual( | ||
'Found. Redirecting to http://localhost:8378/1/apps/verify_email_success.html?username=testEmailVerifyTokenValidity' | ||
'Found. Redirecting to http://localhost:8378/1/apps/verify_email_success.html' | ||
); | ||
done(); | ||
}); | ||
|
@@ -292,6 +292,64 @@ describe('Email Verification Token Expiration: ', () => { | |
}); | ||
}); | ||
|
||
it('can resend email using an expired token', async () => { | ||
const user = new Parse.User(); | ||
const emailAdapter = { | ||
sendVerificationEmail: () => {}, | ||
sendPasswordResetEmail: () => Promise.resolve(), | ||
sendMail: () => {}, | ||
}; | ||
await reconfigureServer({ | ||
appName: 'emailVerifyToken', | ||
verifyUserEmails: true, | ||
emailAdapter: emailAdapter, | ||
emailVerifyTokenValidityDuration: 5, // 5 seconds | ||
publicServerURL: 'http://localhost:8378/1', | ||
}); | ||
user.setUsername('test'); | ||
user.setPassword('password'); | ||
user.set('email', '[email protected]'); | ||
await user.signUp(); | ||
|
||
await Parse.Server.database.update( | ||
'_User', | ||
{ objectId: user.id }, | ||
{ | ||
_email_verify_token_expires_at: Parse._encode(new Date('2000')), | ||
} | ||
); | ||
|
||
const obj = await Parse.Server.database.find( | ||
'_User', | ||
{ objectId: user.id }, | ||
{}, | ||
Auth.maintenance(Parse.Server) | ||
); | ||
const token = obj[0]._email_verify_token; | ||
|
||
const res = await request({ | ||
url: `http://localhost:8378/1/apps/test/verify_email?token=${token}`, | ||
method: 'GET', | ||
}); | ||
expect(res.text).toEqual( | ||
`Found. Redirecting to http://localhost:8378/1/apps/invalid_verification_link.html?appId=test&expiredToken=${token}` | ||
); | ||
|
||
const formUrl = `http://localhost:8378/1/apps/test/resend_verification_email`; | ||
const formResponse = await request({ | ||
url: formUrl, | ||
method: 'POST', | ||
body: { | ||
expiredToken: token, | ||
}, | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
followRedirects: false, | ||
}); | ||
expect(formResponse.text).toEqual( | ||
`Found. Redirecting to http://localhost:8378/1/apps/link_send_success.html` | ||
); | ||
}); | ||
|
||
it_id('9365c53c-b8b4-41f7-a3c1-77882f76a89c')(it)('can conditionally send emails', async () => { | ||
let sendEmailOptions; | ||
const emailAdapter = { | ||
|
@@ -615,7 +673,7 @@ describe('Email Verification Token Expiration: ', () => { | |
}).then(response => { | ||
expect(response.status).toEqual(302); | ||
expect(response.text).toEqual( | ||
'Found. Redirecting to http://localhost:8378/1/apps/verify_email_success.html?username=testEmailVerifyTokenValidity' | ||
`Found. Redirecting to http://localhost:8378/1/apps/invalid_verification_link.html?appId=test&expiredToken=${sendEmailOptions.link.split('token=')[1]}` | ||
); | ||
done(); | ||
}); | ||
|
@@ -668,7 +726,7 @@ describe('Email Verification Token Expiration: ', () => { | |
}).then(response => { | ||
expect(response.status).toEqual(302); | ||
expect(response.text).toEqual( | ||
'Found. Redirecting to http://localhost:8378/1/apps/invalid_verification_link.html?username=testEmailVerifyTokenValidity&appId=test' | ||
`Found. Redirecting to http://localhost:8378/1/apps/invalid_verification_link.html?appId=test&expiredToken=${sendEmailOptions.link.split('token=')[1]}` | ||
dblythy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
); | ||
done(); | ||
}); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.