[Zope] change password through script messes up session

Giampiero Benvenuti giampiero.benvenuti at chiaroscuro.com
Mon Oct 6 12:24:07 EDT 2008


Hi,

what I do:

req=context.REQUEST

context.acl_users.manage_users('Change', {'name':req['name'],  
'password':req['pswd'], 'confirm':req['cpswd'], 'roles': req 
['roles'], 'domains':''})



On Oct 6, 2008, at 3:48 AM, Thibaud Morel l'Horset wrote:

> Hello all,
>
>   I'm trying to write a piece of code that just changes the  
> password of a user as they are logged in. This is in a Script 
> (Python). I'm using PAS and CookieCrumbler and the code is as follows:
> container.acl_users.users.manage_updateUserPassword(user 
> ['id'],password,password)
>
>   This does work and change the password, however what happens then  
> is anytime I try to access a resource that I could view prior to  
> changing the password, I get a basic pop-up auth login prompt (even  
> though I'm using CookieCrumbler), and entering the new creds  
> doesn't work. If I logout through the login/logout link and log  
> back in with the web form, everything is fine (and the new creds do  
> work then).
>
>   Here is the error that's thrown in the logs:
> Traceback (innermost last):
>   Module ZPublisher.Publish, line 106, in publish
>   Module ZPublisher.BaseRequest, line 468, in traverse
>   Module ZPublisher.HTTPResponse, line 687, in unauthorized
>
>
> Unauthorized: <strong>You are not authorized to access this  
> resource.</strong>
>
>   So basically, I can't access any protected object until I log out  
> and log back in.
>
>   Anyone have any insight here? I've been trying to read the Plone  
> source code to figure out how they do it but I can't get their code  
> to work... I've been searching around for an answer to this all  
> weekend but can't find anything :(
>
>   Thanks for the help,
>
> - Teebes
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )



More information about the Zope mailing list