[Zope] create Login/Logout functionality
Andreas Pakulat
ap125@informatik.uni-rostock.de
Mon, 05 May 2003 20:13:01 +0200
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On 05.Mai 2003 - 18:19:26, Andreas Pakulat wrote:
> On 05.Mai 2003 - 10:41:11, Troy Farrell wrote:
> > Using manage_zmi_logout and the zope HelpSys docs, I've come up with=20
> > this script. Play with it:
> >=20
> > ## Script (Python) "authtest"
> > ##bind container=3Dcontainer
> > ##bind context=3Dcontext
> > ##bind namespace=3D
> > ##bind script=3Dscript
> > ##bind subpath=3Dtraverse_subpath
> > ##parameters=3D
> > ##title=3D
> > ##
> > request =3D container.REQUEST
> > response =3D request.RESPONSE
> >=20
> > response.setHeader('Content-Type','text/html')
> >=20
> > print "<html><head><title>authtest</title><body><p>"
> >=20
> > print "you are " + request['AUTHENTICATED_USER'].getUserName()
> >=20
> > if request.get('AUTHENTICATED_USER').getUserName() =3D=3D 'Anonymous Us=
er':
> > print "Trying to authenticate..."
> > response.setStatus('Unauthorized')
> > response.setHeader('WWW-Authenticate', 'basic realm=3D"Zope"', 1)
> >=20
> > print "</p></body></html>"
> > return printed
> >=20
> > #end script
>=20
> I'll try that in a minute, but I also found the Product LoginManager.
Ok, this works nearly perfect. The only thing that doesn't fit my dreams
is that I cannot directly put the user back on the page he was, I'll
have to include some link back. That's a bit annoying, but as it also is
this was within the zmi, I suppose there is no way to do this?!
Andreas
--=20
Don't Worry, Be Happy.
-- Meher Baba
--tThc/1wpZn/ma/RB
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+tqmtuekl0h+nrMIRAiEsAKCb/rQd607eV5lLqFxOfP1DXA3myQCgwiBI
eL82s1FNDJeyJcPr9Sur/pk=
=rBP4
-----END PGP SIGNATURE-----
--tThc/1wpZn/ma/RB--