1. is correct. You can create your own tables but I would let web2py do it for you. Here is the minimal *complete* code you need
#in model db.py from gluon.tools import * auth=Auth(globals(),db) auth.define_tables() #in default.py def user(): return auth() The latter action will expose http://..../yourapp/default/user/login http://..../yourapp/default/user/logout http://..../yourapp/default/user/register http://..../yourapp/default/user/retrieve_password http://..../yourapp/default/user/change_password http://..../yourapp/default/user/profile You can check if a user is logged in by auth.is_logged_in(). You can get the current user with auth.user. You can decorate actions that need login @auth.requires_login() This can do a lot more like role based access control. The plan is to create Auth implementations on top of LDAP, etc. exposing the same interface. We could use help in this direction. Massimo On Mar 21, 10:42 am, Anand Vaidya <[email protected]> wrote: > Hi > > I am a bit lost with the Authentication / Authorization in web2py. I > am using v1.58 > > What I need: > > My current needs are quite minimal. Given a username and password (in > a form), verify the user:pass and let the user in. Block all functions > if anonymous or failed auth. I do not want to use any db (sqlite/ > mysql) for storage of these info, but need to use an ASCII text file. > > I am generating a simple file that looks like apache htpasswd ( user : > md5hashed-password) using python md5 module. I am avoiding Apache's > own htpasswd since the algorithm is too complicated. > > My understanding from the docs and this list is that , the web2py > provided Auth controller will work only with a DB and also generates > Login, Register , Recaptcha etc which I do not need (In fact the app > owner does not allow new self-registrations) > > My questions: > > 1. Is my statement above correct? > > 2. How do solve the auth part? > > 3. If we need to extend the auth to AD, LDAP, /etc/passwd, NIS, > htpasswd, Samba, MySQL etc , is there a generic solution? Are there > any plans in web2py development to abstract out the steps? > > I have already completed the project with CherryPy and Genshi but was > forced to abandon the work due to problems with IE and am recoding in > Web2Py > > Regards > Anand --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

