[Zope] Logon process
Garito
garito at sistes.net
Sat Jul 7 08:17:30 EDT 2007
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 <akm at theinternet.com.au>:
>
> +-------[ 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
> akm at theinternet.com.au
>
--
Mis Cosas
http://blogs.sistes.net/Garito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20070707/0c2d99e4/attachment.htm
More information about the Zope
mailing list