Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

PasswordPolicyControl with value=null #956 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/controls/password-policy-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class PasswordPolicyControl extends Control {
return
}

if (options.value === null) {
return
}

if (Buffer.isBuffer(options.value)) {
this.#parse(options.value)
} else if (isObject(options.value)) {
Expand Down
6 changes: 6 additions & 0 deletions lib/controls/password-policy-control.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ tap.test('contructor', t => {
t.throws(() => new PPC({ value: { timeBeforeExpiration: 1, graceAuthNsRemaining: 2 } }))
})

// null value should not fail #956
t.test('no value shall not fail', async t => {
const control = new PPC({ value: null })
t.same(control.value, {})
})

t.end()
})

Expand Down