-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: usernames should encode all characters in emails
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -52,6 +52,39 @@ describe('Email Verification Token Expiration: ', () => { | |
}); | ||
}); | ||
|
||
it('should send an HTML or properly escaped plain text password reset email', async () => { | ||
const user = new Parse.User(); | ||
let sendEmailOptions; | ||
const emailAdapter = { | ||
sendPasswordResetEmail: (options) => { | ||
sendEmailOptions = options; | ||
}, | ||
sendVerificationEmail: async () => {}, | ||
sendMail: async () => {}, | ||
}; | ||
|
||
await reconfigureServer({ | ||
appName: 'specialCharacterUsernameTest', | ||
publicServerURL: 'http://localhost:8378/1', | ||
emailAdapter: emailAdapter, | ||
}); | ||
|
||
user.setUsername('hello :)'); | ||
user.setPassword('password123'); | ||
user.set('email', '[email protected]'); | ||
await user.signUp(); | ||
|
||
await Parse.User.requestPasswordReset('[email protected]'); | ||
|
||
expect(sendEmailOptions).not.toBeUndefined(); | ||
|
||
const { link, html, text } = sendEmailOptions; | ||
Check failure on line 81 in spec/EmailVerificationToken.spec.js
|
||
|
||
const username = link.split('username=')[1]; | ||
expect(username).toBe('%68%65%6C%6C%6F%20%3A%29'); | ||
}); | ||
|
||
|
||
it('emailVerified should set to false, if the user does not verify their email before the email verify token expires', done => { | ||
const user = new Parse.User(); | ||
let sendEmailOptions; | ||
|
This file contains 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 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