Skip to content

Commit

Permalink
added req and reply to forbiddenPageFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesread committed Sep 13, 2017
1 parent 66b3bff commit 80011c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
5 changes: 4 additions & 1 deletion index.js
Expand Up @@ -37,7 +37,10 @@ function plugin (server, opts, next) {
.then((isAuthorized) => {
debug('isAuthorized: %s', isAuthorized)
if (!isAuthorized) {
reply(combinedOptions.forbiddenPageFunction ? combinedOptions.forbiddenPageFunction(callbackObject) : Boom.forbidden())
const result = combinedOptions.forbiddenPageFunction ? combinedOptions.forbiddenPageFunction(callbackObject, req, reply) : Boom.forbidden()
if (!combinedOptions.forbiddenPageFunction || (combinedOptions.forbiddenPageFunction && combinedOptions.forbiddenPageFunction.length === 1)) {
reply(result)
}
} else {
reply.continue()
}
Expand Down

0 comments on commit 80011c9

Please sign in to comment.