collective / collective.pwexpiry

Emulate Active Directory password complexity requirements.
1 stars 6 forks source link

fix a `KeyError` in the unlock process #9

Closed skurfer closed 8 years ago

skurfer commented 8 years ago

Maybe this depends on your browser, but if the “Unlock” box is unchecked for one or more users when submitting the form from the control panel, the request omits the value completely.

With the box checked:

PDB++> self.request['users']
[{'id': 'timmy', 'unlock': '1'}]

With the box unchecked:

PDB++> self.request['users']
[{'id': 'timmy'}]

So you can’t test the value because it’s not there. Using .get() should make it behave correctly in all cases.

frisi commented 8 years ago

just stumbled upon the same issue. thanks @skurfer