-
-
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.
Merge pull request #1001 from ParsePlatform/flovilmart.queryStringFor…
…EmailResets Properly querystring encode the parameters
- Loading branch information
Showing
3 changed files
with
67 additions
and
62 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 |
---|---|---|
|
@@ -23,9 +23,9 @@ describe("Custom Pages Configuration", () => { | |
}, | ||
publicServerURL: "https://my.public.server.com/1" | ||
}); | ||
|
||
var config = new Config("test"); | ||
|
||
expect(config.invalidLinkURL).toEqual("myInvalidLink"); | ||
expect(config.verifyEmailSuccessURL).toEqual("myVerifyEmailSuccess"); | ||
expect(config.choosePasswordURL).toEqual("myChoosePassword"); | ||
|
@@ -78,7 +78,7 @@ describe("Email Verification", () => { | |
} | ||
}); | ||
}); | ||
|
||
it('does not send verification email when verification is enabled and email is not set', done => { | ||
var emailAdapter = { | ||
sendVerificationEmail: () => Promise.resolve(), | ||
|
@@ -119,7 +119,7 @@ describe("Email Verification", () => { | |
} | ||
}); | ||
}); | ||
|
||
it('does send a validation email when updating the email', done => { | ||
var emailAdapter = { | ||
sendVerificationEmail: () => Promise.resolve(), | ||
|
@@ -169,7 +169,7 @@ describe("Email Verification", () => { | |
} | ||
}); | ||
}); | ||
|
||
it('does send with a simple adapter', done => { | ||
var calls = 0; | ||
var emailAdapter = { | ||
|
@@ -311,7 +311,7 @@ describe("Email Verification", () => { | |
followRedirect: false, | ||
}, (error, response, body) => { | ||
expect(response.statusCode).toEqual(302); | ||
expect(response.body).toEqual('Found. Redirecting to http://localhost:8378/1/apps/verify_email_success.html?username=zxcv'); | ||
expect(response.body).toEqual('Found. Redirecting to http://localhost:8378/1/apps/verify_email_success.html?username=user'); | ||
user.fetch() | ||
.then(() => { | ||
expect(user.get('emailVerified')).toEqual(true); | ||
|
@@ -342,7 +342,7 @@ describe("Email Verification", () => { | |
publicServerURL: "http://localhost:8378/1" | ||
}); | ||
user.setPassword("asdf"); | ||
user.setUsername("zxcv"); | ||
user.setUsername("user"); | ||
user.set('email', '[email protected]'); | ||
user.signUp(); | ||
}); | ||
|
@@ -453,7 +453,7 @@ describe("Email Verification", () => { | |
}); | ||
|
||
describe("Password Reset", () => { | ||
|
||
it('should send a password reset link', done => { | ||
var user = new Parse.User(); | ||
var emailAdapter = { | ||
|
@@ -468,7 +468,7 @@ describe("Password Reset", () => { | |
return; | ||
} | ||
expect(response.statusCode).toEqual(302); | ||
var re = /http:\/\/localhost:8378\/1\/apps\/choose_password\?token=[a-zA-Z0-9]+\&id=test\&username=zxcv/; | ||
var re = /http:\/\/localhost:8378\/1\/apps\/choose_password\?token=[a-zA-Z0-9]+\&id=test\&username=zxcv%2Bzxcv/; | ||
expect(response.body.match(re)).not.toBe(null); | ||
done(); | ||
}); | ||
|
@@ -491,7 +491,7 @@ describe("Password Reset", () => { | |
publicServerURL: "http://localhost:8378/1" | ||
}); | ||
user.setPassword("asdf"); | ||
user.setUsername("zxcv"); | ||
user.setUsername("zxcv+zxcv"); | ||
user.set('email', '[email protected]'); | ||
user.signUp().then(() => { | ||
Parse.User.requestPasswordReset('[email protected]', { | ||
|
@@ -503,7 +503,7 @@ describe("Password Reset", () => { | |
}); | ||
}); | ||
}); | ||
|
||
it('redirects you to invalid link if you try to request password for a nonexistant users email', done => { | ||
setServerConfiguration({ | ||
serverURL: 'http://localhost:8378/1', | ||
|
@@ -555,8 +555,8 @@ describe("Password Reset", () => { | |
return; | ||
} | ||
var token = match[1]; | ||
request.post({ | ||
|
||
request.post({ | ||
url: "http://localhost:8378/1/apps/test/request_password_reset" , | ||
body: `new_password=hello&token=${token}&username=zxcv`, | ||
headers: { | ||
|
@@ -571,15 +571,15 @@ describe("Password Reset", () => { | |
} | ||
expect(response.statusCode).toEqual(302); | ||
expect(response.body).toEqual('Found. Redirecting to http://localhost:8378/1/apps/password_reset_success.html'); | ||
|
||
Parse.User.logIn("zxcv", "hello").then(function(user){ | ||
done(); | ||
}, (err) => { | ||
console.error(err); | ||
fail("should login with new password"); | ||
done(); | ||
}); | ||
|
||
}); | ||
}); | ||
}, | ||
|
@@ -613,6 +613,5 @@ describe("Password Reset", () => { | |
}); | ||
}); | ||
}); | ||
|
||
}) | ||
|
||
}) |
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