Hi guys
I'm trying to make a membership site but I'm struggling a little and would love a little help
# 1. How can I select where go if login fails? Can I add something next to the 'next=URL' that's similar?
# 2. How can I select so uses c/b/b3 to login instead of c/default/user/login?
# 3. When I login, it logs me out instantly - how can I not logout instantly?
I'm on Pythonanywhere, and I've got an app called "c"
APP: c
------------------------------------------
MODEL: a.py...
db = DAL ('sqlite://storage.sqlite')
from gluon.tools import Auth
auth = Auth(db, controller='b')
auth.settings.controller = 'b'
auth.settings.on_failed_authorization = URL('c',args='b/b3')
auth.settings.login_url = URL(request.application, 'c', 'b3')
auth.define_tables(username=False,signature=False)
------------------------------------------
CONTROLLER: b.py...
#home page
def b1():
display_page = XML('<h1>Home Page</h1>')
return dict(display_page = display_page)
#regn page
def b2():
display_page = XML('<h1>Registration Page</h1>')
return dict(display_page = display_page, form=auth.register(next=URL('b3')))
#login page
def b3():
display_page = XML('<h1>Login Page</h1>')
return dict(display_page = display_page, form=auth.login(next=URL('b4')))
# 1. How can I select where go if login fails? Can I add something next to the 'next=URL' that's similar?
#members page
@auth.requires_login()
# 2. How can I select so uses c/b/b3 to login instead of c/default/user/login?
def b4():
auth.settings.login_url = URL('b', 'b3')
display_page = XML('<h1>Members Page</h1>')
return dict(display_page = display_page, form=auth.logout(next=URL('b1')))
# 3. When I login, it logs me out instantly (and sends me to b1) - how can I not logout instantly?
------------------------------------------
VIEW: b/b1.html...
{{=display_page}}
VIEW: b/b2 and b3 and b4 are the same...
{{=display_page}}
{{=form}}
------------------------------------------
Any help would be greatly appreciated - especially with question 2.