-
-
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.
Add parseFrameURL for masking user-facing pages (#3267)
* Add parseFrameURL for masking user-facing pages. Allow users to specify a different address which is used to mask parse requests for verifying email and resetting password. This is how Parse.com used to allow customers to gain control over page content, styling etc. On the destination page javascript is used to check the link in the request and embed the parse server page using IFRAME. * Fix code indentation * Rename method for building link and pass config to it. * Add customPages options to README.md. * Add tests for parseFrameURL email link building, and parseFrameURL option. * Add parseFrameURL for masking user-facing pages. Allow users to specify a different address which is used to mask parse requests for verifying email and resetting password. This is how Parse.com used to allow customers to gain control over page content, styling etc. On the destination page javascript is used to check the link in the request and embed the parse server page using IFRAME. * Fix code indentation * Rename method for building link and pass config to it. * Add customPages options to README.md. * Don't Object.assign to defaultConfiguration global
- Loading branch information
Showing
5 changed files
with
82 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
var UserController = require('../src/Controllers/UserController').UserController; | ||
var emailAdapter = require('./MockEmailAdapter') | ||
var AppCache = require('../src/cache').AppCache; | ||
|
||
describe('UserController', () => { | ||
var user = { | ||
_email_verify_token: 'testToken', | ||
username: 'testUser', | ||
email: '[email protected]' | ||
} | ||
|
||
describe('sendVerificationEmail', () => { | ||
describe('parseFrameURL not provided', () => { | ||
it('uses publicServerURL', (done) => { | ||
|
||
AppCache.put(defaultConfiguration.appId, Object.assign({}, defaultConfiguration, { | ||
publicServerURL: 'http://www.example.com', | ||
customPages: { | ||
parseFrameURL: undefined | ||
} | ||
})) | ||
|
||
emailAdapter.sendVerificationEmail = (options) => { | ||
expect(options.link).toEqual('http://www.example.com/apps/test/verify_email?token=testToken&username=testUser') | ||
done() | ||
} | ||
|
||
var userController = new UserController(emailAdapter, 'test', { | ||
verifyUserEmails: true | ||
}) | ||
|
||
userController.sendVerificationEmail(user) | ||
}) | ||
}) | ||
|
||
describe('parseFrameURL provided', () => { | ||
it('uses parseFrameURL and includes the destination in the link parameter', (done) => { | ||
|
||
AppCache.put(defaultConfiguration.appId, Object.assign({}, defaultConfiguration, { | ||
publicServerURL: 'http://www.example.com', | ||
customPages: { | ||
parseFrameURL: 'http://someother.example.com/handle-parse-iframe' | ||
} | ||
})) | ||
|
||
emailAdapter.sendVerificationEmail = (options) => { | ||
expect(options.link).toEqual('http://someother.example.com/handle-parse-iframe?link=%2Fapps%2Ftest%2Fverify_email&token=testToken&username=testUser') | ||
done() | ||
} | ||
|
||
var userController = new UserController(emailAdapter, 'test', { | ||
verifyUserEmails: true | ||
}) | ||
|
||
userController.sendVerificationEmail(user) | ||
}) | ||
}) | ||
}) | ||
}); |
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
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