-
-
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.
- Loading branch information
1 parent
19b0462
commit a88ccb0
Showing
3 changed files
with
61 additions
and
37 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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
"use strict"; | ||
|
||
var request = require('request'); | ||
var Config = require("../src/Config"); | ||
let MockEmailAdapterWithOptions = require('./MockEmailAdapterWithOptions'); | ||
let request = require('request'); | ||
let Config = require("../src/Config"); | ||
|
||
describe("Custom Pages Configuration", () => { | ||
it("should set the custom pages", (done) => { | ||
setServerConfiguration({ | ||
|
@@ -282,6 +284,38 @@ describe("Email Verification", () => { | |
}); | ||
}); | ||
|
||
it('fails if you set include an emailAdapter, set verifyUserEmails to false, dont set a publicServerURL, and try to send a password reset email (regression test for #1649)', done => { | ||
setServerConfiguration({ | ||
serverURL: 'http://localhost:8378/1', | ||
appId: 'test', | ||
appName: 'unused', | ||
javascriptKey: 'test', | ||
dotNetKey: 'windows', | ||
clientKey: 'client', | ||
restAPIKey: 'rest', | ||
masterKey: 'test', | ||
collectionPrefix: 'test_', | ||
fileKey: 'test', | ||
verifyUserEmails: false, | ||
emailAdapter: MockEmailAdapterWithOptions({ | ||
fromAddress: '[email protected]', | ||
apiKey: 'k', | ||
domain: 'd', | ||
}), | ||
}) | ||
|
||
let user = new Parse.User(); | ||
user.setPassword("asdf"); | ||
user.setUsername("zxcv"); | ||
user.set("email", "[email protected]"); | ||
user.signUp(null) | ||
.then(user => Parse.User.requestPasswordReset("[email protected]")) | ||
.catch(error => { | ||
expect(error.message).toEqual('An appName, publicServerURL, and emailAdapter are required for password reset functionality.') | ||
done(); | ||
}); | ||
}); | ||
|
||
it('does not send verification email if email verification is disabled', done => { | ||
var emailAdapter = { | ||
sendVerificationEmail: () => Promise.resolve(), | ||
|
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 |
---|---|---|
|
@@ -361,26 +361,4 @@ describe('server', () => { | |
expect(() => setServerConfiguration({ revokeSessionOnPasswordReset: 'non-bool' })).toThrow(); | ||
done(); | ||
}); | ||
|
||
it('fails if you set verifyUserEmails to true without setting an app ID or publicServerURL (regression test for #1649)', done => { | ||
expect(() => setServerConfiguration({ | ||
serverURL: 'http://localhost:8378/1', | ||
appId: 'test', | ||
appName: 'unused', | ||
javascriptKey: 'test', | ||
dotNetKey: 'windows', | ||
clientKey: 'client', | ||
restAPIKey: 'rest', | ||
masterKey: 'test', | ||
collectionPrefix: 'test_', | ||
fileKey: 'test', | ||
verifyUserEmails: true, | ||
emailAdapter: MockEmailAdapterWithOptions({ | ||
fromAddress: '[email protected]', | ||
apiKey: 'k', | ||
domain: 'd', | ||
}), | ||
})).toThrow('A public server url is required when using email verification.'); | ||
done(); | ||
}); | ||
}); |
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