I'm writing a little PAS plugin to enable password expiration.
When I set the property in my handler it seems to work but when it
returns back to the caller the property values have reverted. For
example...
def updateCredentials(self, request, response, login, new_password):
mtool = getToolByName(self, 'portal_membership', None)
if not mtool:
return
member = mtool.getMemberById(login)
if not member:
return
member.setMemberProperties(dict(must_change_password=True))
return
last_password_change = member.getProperty('last_password_change')
expired = (not last_password_change) or (DateTime() -
DateTime(last_password_change) > 60)
if expired:
member.setMemberProperties(dict(must_change_password=True))
assert member.getProperty('must_change_password') == True
This gives me no errors. But my functional doctest fails:
Try to login now and the system should set must_change_password. Also
we should receive a status message
>>> browser.getLink('Log in').click()
>>> browser.getControl(name='__ac_name').value = PTC.default_user
>>> browser.getControl(name='__ac_password').value = PTC.default_password
>>> browser.getControl(name='submit').click()
This isn't true black box testing but it is nice to check the
implementation somewhat as well.
>>> member.getProperty('must_change_password')
True
Is this indeed possible ? I can't see any reason why I shouldn't be able
to set member properties from the PAS property unless there is some
collision using a PAS plugin (memberdata) from another PAS plugin?
Thanks,
-jordan.
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers