Hi Andrew!

This is my form code:

<html>
 <head>
   <title tal:content="template/title">The title</title>
 </head>
 <body>
   <form method="post" tal:attributes="action here/Logon/absolute_url">
     Usuario: <input type="text" name="__ac_name" />
     ContraseƱa: <input type="password" name="__ac_password" />
     <button type="submit">Logar</button>
   </form>
 </body>
</html>

And this is the Logon code:

from AccessControl import getSecurityManager

usuario = context.acl_users.validate(context.REQUEST)

print str(usuario)
print getSecurityManager().getUser().getUserName()

return printed

Did I understand you? (this code doesn't work ok)

Where is the mistake?

Thank you so much!!!!

2007/7/7, Andrew Milton <[EMAIL PROTECTED]>:

+-------[ Garito ]----------------------
| I try context.acl_users.authenticate(user, pass, request) but this
doesn't
| change the session user, isn't it?
|
| Can I change the logged user in the session in any way?

I'm not sure what you mean by "in the session".

If you want to change the cookies et.al as you go, you call
acl_users.remember(username, password, request) after the call to
authenticate
IF you get a user object back (i.e. authenticate was successful)

Either that or you can stuff the request with __ac_name and __ac_password
and
call acl_users.validate(request), however this is not the preferred method
to
use for changing the logged in user on the fly.

--
Andrew Milton
[EMAIL PROTECTED]




--
Mis Cosas
http://blogs.sistes.net/Garito
_______________________________________________
Zope maillist  -  Zope@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 )

Reply via email to