-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow null setting for domain #65
Conversation
yep, +1 ) |
@@ -57,7 +57,7 @@ internals.implementation = function (server, options) { | |||
cookieOptions.ttl = settings.ttl; | |||
} | |||
|
|||
if (settings.domain) { | |||
if (settings.hasOwnProperty('domain')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Statehood sets domain
to null
via defaults, this isn't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that makes sense. It's worth pointing out though, that with the validation happening first there's no way to trigger that branch of logic -- no falsey value will pass validation for domain, presently.
@mshick include changes for |
@gansbrest Do you have an specific property and falsey value which you need support for? |
Okay, will do. I’ll push up the validation change in a sec, along with a test. I don’t mean to badger you. If redirectTo isn’t a change you want to make I understand.
|
Should domain also be changed to allow false? |
Null is allowed by statehood, false is not. That's the rationale -- consistency.
|
path: Joi.string().default('/'), | ||
clearInvalid: Joi.boolean().default(false), | ||
keepAlive: Joi.boolean().default(false), | ||
isSecure: Joi.boolean().default(true), | ||
isHttpOnly: Joi.boolean().default(true), | ||
redirectTo: Joi.string(), | ||
redirectTo: Joi.string().allow(false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be allow('')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used false to be consistent with the docs for redirectTo at the route level:
To set an individual route to use or disable redirections, use the route plugins config ({ config: { plugins: { 'hapi-auth-cookie': { redirectTo: false } } } }). Defaults to no redirection.
In light of that, would you still like me to change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, the allow
value will override the data type.
> Joi.validate(false, Joi.string().allow(false))
{ error: null, value: false }
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Per #64 allows domains to be set to
null
an allowed value forserver.state
.