Ability to force user to reset password + additional method #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi skelsec,
I played around with msldap and tried to force a user to reset his password. What I found out is, that the single_interval method from typeconversion.py does not have implemented a condition, if encode is set to True.
So I made a workaround for this issue and set the pwdLastSet Attribute with a single_int in the MSLDAP_BUILTIN_ATTRIBUTE_TYPES_ENC list. This way, I am able to make a change to the attribute with following two params:
0 (int) > forces the user to reset the password at next logon
-1 (int) > reverts the password change force and sets the timestamp to the actual time now
(this workflow is also used by the account option build-in "User must change password at next logon")
Another idea was to implement the missing part in the single_interval method but I am not sure, if or what else may not work correctly, if an condition for encoded=true is in place, to set integer values.
If this is an valid way for you to add this functionality, I would be happy if you approve or correct this PR.
Also inside this PR the method get_dn() in client.py is implemented, to be able to gather the distinguished name by samAccountName.
Best regards,
Daniel