This is a quick one here, It's (extremely) ugly and basic, but should give 
you a framework to figure out from.
I did it on pythonanywhere for free which is pretty cool. The template 
below should work on local or others though.

No email out or $ because the pythonanywhere free version doesn't allow 
that.

To access the members list it's under app admin - note web2py does a lot of 
the setting up of tables and stuff for you.
I had to put the auth setting stuff in the controller because I couldn't 
get the re-directs to work any other way. (frustrating as heck).
Also the views are not b1 or b2, they are e/b1 or e/b2 so that it's created 
in a folder. (These caught me out for a long time).

To access, go to https://XXXXXX.pythonanywhere.com/c/e/b1 
<https://xxxxxx.pythonanywhere.com/c/e/b1>

Create App: C

Create Model: a.py

..................................................................

db = DAL ('sqlite://storage.sqlite')

from gluon.tools import Auth

auth = Auth(db)

auth.define_tables(username=False,signature=False)

..................................................................

Create Controller: e.py

..................................................................

#to access, go to https://XXXXXX.pythonanywhere.com/c/e/b1 
<https://xxxxxx.pythonanywhere.com/c/e/b1>

#setting stuff

auth.settings.controller = 'e'

auth.settings.on_failed_authorization = URL('e', 'b1')

auth.settings.login_url = URL('b3')

#home page

def b1():

   display_page = XML('<h1>Home Page</h1><a 
href="b2">Registration</a><br><a href="b4">Login to members</a>')

   return dict(display_page = display_page)

#regn page

def b2():

   display_page = XML('<h1>Registration Page</h1><a href="b4">or Skip this 
page and Login to members page</a>')

   return dict(display_page = display_page, 
form=auth.register(next=URL('b4')))

#login page

def b3():

   display_page = XML('<h1>Login Page</h1>')

   return dict(display_page = display_page, form=auth.login(next=URL('b4')))

#members page

@auth.requires_login()

def b4():

   display_page = XML('<h1>Members Page</h1><a href="b5">Logout</a>')

   return dict(display_page = display_page)

def b5():

   display_page = XML('<h1>Logging Out</h1>')

   return dict(display_page = display_page, form=auth.logout(next=URL('b1'
)))

..................................................................

Create a new view: e/b1............

{{=display_page}}

................................

Create a new view: e/b2............

{{=display_page}}

{{=form}}

................................

Create a new view: e/b3............

{{=display_page}}

{{=form}}

................................

Create a new view: e/b4............

{{=display_page}}

................................

Create a new view: e/b5............

{{=display_page}}

{{=form}}
................................


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to