[Fwd: Re: [Zope] [Newbie] Making my own authentication form - HOW
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
Wow, thank you I will try it out. You have been very kind. Zahid On Fri, Mar 08, 2002 at 11:46:14AM +0100, Antonio Beamud Montero wrote:
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.
Content-Description: Reenviado mensaje - Re: [Zope] [Newbie] Making my own authentication form
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
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.
-- -------------------------------------------------------------------- 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
-- -------------------------------------------------------------------- Dr Zahid Malik Tel: +44 (0) 20 7594 6336 Research Fellow Fax: +44 (0) 20 7581 4419 Dept. of Electrical Eng. Email: z.malik@ic.ac.uk Imperial College http://infoeng.ee.ic.ac.uk/~malikz Exhibition Road London SW7 2BT
participants (2)
-
Antonio Beamud Montero -
Zahid Malik