SOLVED!!!!

Hi Marlysson

Thanks for your help

In the end I didn't need to do any defining or anything too much.
For 1 (failed login), I put the auth settings into the controller instead 
of the model
For 2. (selecting login page) I also put the auth settings into the 
controller
For 3. (logout) I just put the logout into a separate view.

So in the end, here is the complete membership site  - yay!

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

App: C

Model: a.py
..................................................................
db = DAL ('sqlite://storage.sqlite')
from gluon.tools import Auth
auth = Auth(db)
auth.define_tables(username=False,signature=False)
..................................................................

Controller: e.py
..................................................................
#to access, go to 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')))
..................................................................
View: e/b1............
{{=display_page}}
................................
View: e/b2............
{{=display_page}}
{{=form}}
................................
View: e/b3............
{{=display_page}}
{{=form}}
................................
View: e/b4............
{{=display_page}}
................................
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to