[Zope] html form authentication
Iņigo Serna
inigoserna@terra.es
30 Mar 2003 17:58:19 +0200
--=-mRszF/Zr0ikjnPwlWBBx
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable
Hello,
I want to authenticate users from acl_users with my own HTML form and a pyt=
hon script.
I can't use user._getPassword() because it's an internal method.
and it seems user.authenticate function calls browser authentication again.
How could I achieve this?
This is the code I use:
*************** ZPT "form" ***************
...
<form action=3D"login" method=3D"post">
<table class=3D"form">
<tbody>
<tr>
<th class=3D"text">Name: </th>
<td><input name=3D"user" size=3D"12" maxlength=3D"12"
value=3D""></td>
</tr>
<tr>
<th class=3D"text">Password: </th>
<td><input name=3D"password" type=3D"password" size=3D"12"
maxlength=3D"8" value=3D""></td>
</tr>
<tr><td> </td></tr>
<tr>
<td align=3D"center">
<input type=3D"reset" value=3D"Clean">
</td>
<td align=3D"center">
<input type=3D"SUBMIT" value=3D"Submit">
</td>
</tr>
</tbody>
</table>
</form>
...
*********************************************
*************** Script (Python) "login" ***************
request =3D container.REQUEST
RESPONSE =3D request.RESPONSE
user =3D container.acl_users.getUser(request.user)
try:
if user.authenticate('the_password', request):=20
print 'OK'
else:
print 'FAILED'
except AttributeError:
print 'User doesn\' exist'
return printed
*********************************************
Thanks in advance,
I=F1igo
--=-mRszF/Zr0ikjnPwlWBBx
Content-Type: application/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQA+hxQbfN63/+cBjZoRAoPtAKDC1tm0YiuIHZcMBXwaPndjWjt6BACgyaj+
KmONAxR8U2XIcSVXIHO0keE=
=kC2x
-----END PGP SIGNATURE-----
--=-mRszF/Zr0ikjnPwlWBBx--