[Fwd: Re: [Zope] [Newbie] Making my own authentication form - HOW

Antonio Beamud Montero antonio.beamud@agora-2000.com
08 Mar 2002 11:46:14 +0100


--=-8sPqqf/50w2gGPDew4Ov
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

I will describe how I solved "making my own authentication form" :-)
Well my product is based in folders, and I need when create a instance
of my product automagically create a user folder, a cookie mecanism and
the login forms, but I don't want to touch the cookie crumbler login
forms... I will do that:
from Products.CookieCrumbler.CookieCrumbler import CookieCrumbler,
manage_addCC

class MyProduct(Folder):
  .....
  def create_user_logins(self):
    """ Create the user login forms, etc..."""
     # Create the built-in user folder    
     self.manage_addUserFolder()
     # create the Cookie Crumbler product instance, by default it     
     # doesn't create login forms
     manage_addCC(self,'Cookies')
     # Example. How to create a user from an external method
     self.acl_users.userFolderAddUser('exuser','exuser',['Manager'],'')
     # Create our login forms
     self.create_login_forms()
    
  def create_login_forms():
     addDTML(self, 'login_form','Pantalla de acceso', 'dtml/login_form')
     addDTML(self, 'logged_in', 'Pantalla de inicio', 'dtml/logged_in')
     addDTML(self, 'logged_out', 'Pantalla de salida','dtml/logged_out')

#Piece of code from Squishdot :-)

file_path=Globals.package_home(globals())
def addDTML(obj, id, title, file):
    f = open(file_path + '/' + file + '.dtml')
    file = f.read()
    f.close()
    obj.manage_addDTMLMethod(id, title, file)
    return getattr(obj, id)

Inside my dtml directory I have three methods: login_form, logged_in,
logged_out, in this moment are the login forms that comes with Cookie
Crumbler product, but you can put all that you want...

I hope that this howto help you...

-- 
Microsoft merges technologoies: 
Windows CE + Windows ME + Windows NT = Windows CEMENT

----
Antonio Beamud Montero
Agora Systems S.A.

http://www.agoratechnologies.com

--=-8sPqqf/50w2gGPDew4Ov
Content-Disposition: inline
Content-Description: Reenviado mensaje - Re: [Zope] [Newbie] Making my own
	authentication form
Content-Type: message/rfc822

Return-Path: <z.malik@ic.ac.uk>
Received: from mr4.cc.ic.ac.uk (mr4.cc.ic.ac.uk [155.198.5.114]) by
	aspid.agora-2000.com (Postfix) with ESMTP id CC976783F8 for
	<antonio.beamud@agora-2000.com>; Fri,  8 Mar 2002 11:23:42 +0100 (CET)
Received: from hide.ee.ic.ac.uk ([155.198.120.14]
	helo=eecfsag2.ee.ic.ac.uk) by mr4.cc.ic.ac.uk with esmtp (Exim 3.31 #1) id
	16jHXJ-00063I-04; Fri, 08 Mar 2002 10:23:41 +0000
Received: from zaphod ([155.198.123.35] helo=zaphod.ee.ic.ac.uk ident=mail)
	by eecfsag2.ee.ic.ac.uk with esmtp (Exim 1.90 #1) id 16jHWR-0003xl-00; Fri,
	8 Mar 2002 10:22:47 +0000
Received: from malikz by zaphod.ee.ic.ac.uk with local (Exim 3.35 #1
	(Debian)) id 16jHZr-0001q8-00; Fri, 08 Mar 2002 10:26:19 +0000
Date: Fri, 8 Mar 2002 10:26:19 +0000
From: Zahid Malik <z.malik@ic.ac.uk>
To: Antonio Beamud Montero <antonio.beamud@agora-2000.com>
Cc: zope@zope.org
Subject: Re: [Zope] [Newbie] Making my own authentication form
Message-ID: <20020308102619.GD511@zaphod.ee.ic.ac.uk>
References: <20020307183749.GA31090@zaphod.ee.ic.ac.uk>
	<Pine.LNX.4.30.0203071347140.21309-100000@temp.joelburton.com>
	<20020307220430.GB31090@zaphod.ee.ic.ac.uk> <1015576523.708.6.camel@praga>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1015576523.708.6.camel@praga>
User-Agent: Mutt/1.3.27i
Sender: Zahid Malik <malikz@zaphod.ee.ic.ac.uk>

That is very encouraging to here. If it is ok with you I think it would
be useful for people if you could possibly post some code snippets
showing exactly how you did the dtml methods. I know I would find this
extremely useful and time saving.

I will definetly be going down the CookieCrumbler route. I even emailed
Jens (who wrote CUF) and he reccommended use using CookieCrumbler with a
normal acl_user folder for this type of problem.

Thanks for your time

Zahid

On Fri, Mar 08, 2002 at 09:35:23AM +0100, Antonio Beamud Montero wrote:
> El jue, 07-03-2002 a las 23:04, Zahid Malik escribi?:
> > Many thanks
> > 
> > I'll look at cookie crumbler because that would be ideal for my purposes
> > although have played with exUserFolder before but couldn't get the forms
> > working. That was a few revisions ago so things might have changed.
> > 
> 
> Cookie crumbler is very easy to configure and works fine. Only you need
> is to redefine the login_form.dtml, logged_in.dtml and logged_out.dtml
> and all works ok.
> I have defined this DTML methods in my own product and create an User
> Folder and a Cookie Crumbler (with its default login methods), after I
> create this login forms in the same folder that lives acl_user an Cookie
> crumbler and all works ok... 
> 
> Greetings
> -- 
> Microsoft merges technologoies: 
> Windows CE + Windows ME + Windows NT = Windows CEMENT
> 
> ----
> Antonio Beamud Montero
> Agora Systems S.A.
> 
> http://www.agoratechnologies.com
> 

-- 
--------------------------------------------------------------------
Dr Zahid Malik				Tel: +44 (0) 20 7594 6336
Research Fellow				Fax: +44 (0) 20 7581 4419
Dept. of Electrical Eng.		Email: 
Imperial College			http://infoeng.ee.ic.ac.uk/~malikz
Exhibition Road				
London  SW7 2BT

--=-8sPqqf/50w2gGPDew4Ov--