sshttp.build_redirect_uri('/getacc.py', '/groupctl.py?creategroup=1')) else: DATA += """<p align="center"><br/><button><a href="/register.py">Register Now</a></button></p> <p class="footnote">Website designed by Brian Hession</p>""" ASIDE = """ <h2>What is it?</h2> <p>Secret santa registration and group planner.</p> <h2 style="margin-top: 15px;">How does it work?</h2> <p>Register now and invite your friends!</p> """ MOBILE = '<p align="center"><br/><button><a href="/register.py">Register Now</a></button></p>' if loggedin: ASIDE = """<h2>What is it?</h2> <p>Secret santa registration and group planner.</p> <h2 style="margin-top: 15px;">How does it work?</h2> <p>Create a group now and invite your friends!</p>""" MOBILE = '<p align="center"><br/><button><a href="{}">Create a Group Now</a></button></p>'.format( sshttp.build_redirect_uri('/getacc.py', '/groupctl.py?creategroup=1')) replace = { 'desktopNavLinks': sshtml.buildDesktopNavLinks('About'), 'navLinks': sshtml.buildNavLinks('About'), 'accountLinks': sshtml.buildAccountLinks(loggedin), 'body': sshtml.buildBody(data=DATA, aside=ASIDE, mobile=MOBILE) } sshttp.send200(sshtml.buildContainerPage(replace)) except: sshttp.senderror(500) import sys, traceback traceback.print_exc(file=sys.stderr)
formatting = ERROR.format('Must provide an email') elif 'nopassword' in args: formatting = ERROR.format('Must provide a password') elif 'invalid' in args: formatting = ERROR.format('Invalid username or password') data = DATA.format( formatting, sshttp.build_redirect_uri('/signin.py', redirect)) replace = { 'resources': sshtml.buildResources({'/css/signin.css': 'stylesheet'}), 'desktopNavLinks': sshtml.buildDesktopNavLinks(), 'navLinks': sshtml.buildNavLinks(), 'accountLinks': sshtml.buildAccountLinks(False), 'body': sshtml.buildBody(data=data, aside=ASIDE, mobile=MOBILE) } sshttp.send200(sshtml.buildContainerPage(replace)) elif sshttp.is_post(): parameters = dict() if redirect: parameters['redirect'] = redirect if 'email' not in args: parameters['noemail'] = 1 sshttp.send302(sshttp.build_uri('/signin.py', parameters)) elif 'password' not in args: parameters['nopassword'] = 1 sshttp.send302(sshttp.build_uri('/signin.py', parameters))
<p>Secret santa registration and group planner.</p> <h2 style="margin-top: 15px;">How does it work?</h2> <p>Create a group now and invite your friends!</p>""" MOBILE = '<p align="center"><br/><button><a href="{}">Create Group Now</a></button></p>'.format( sshttp.build_redirect_uri('/getacc.py', '/groupctl.py?creategroup=1')) user = sessions.get_user() DATA = DATA.format( userstable.USERS_SCHEMA.get(user, 'name'), userstable.USERS_SCHEMA.get(user, 'email'), sshttp.build_redirect_uri('/getacc.py', '/updateacc.py?changename=1'), sshttp.build_redirect_uri('/getacc.py', '/updateacc.py?changepassword=1')) replace = { 'desktopNavLinks': sshtml.buildDesktopNavLinks('Account'), 'navLinks': sshtml.buildNavLinks('Account'), 'accountLinks': sshtml.buildAccountLinks(True), 'body': sshtml.buildBody(data=DATA, aside=ASIDE, mobile=MOBILE) } sshttp.send200(sshtml.buildContainerPage(replace)) else: sshttp.senderror(403) except: sshttp.senderror(500) import sys, traceback traceback.print_exc(file=sys.stderr)
try: import sessions, sshtml, userstable args = sshttp.get_parameters() if sessions.session_is_valid(): DATA = '<p>You are already signed in. Please sign out to continue.</p>' ASIDE = """<h2>What is it?</h2> <p>Secret santa account registration</p> <h2 style="margin-top: 15px;">How does it work?</h2> <p>Enter your information in the fields. Once completed, you can either create a group or be invited by others.</p>""" MOBILE = '' replace = { 'desktopNavLinks': sshtml.buildDesktopNavLinks(), 'navLinks': sshtml.buildNavLinks(), 'accountLinks': sshtml.buildAccountLinks(False), 'body': sshtml.buildBody(data=DATA, aside=ASIDE, mobile=MOBILE) } sshttp.send200(sshtml.buildContainerPage(replace)) else: if sshttp.is_get(): DATA = """<form id="register" action="/register.py" method="post"> <div class="register"> <h1>Register</h1> <p>Please fill out this form to create an account.</p> {} <hr/> <label for="email">Email</label> <input type="text" placeholder="Enter your email" name="email" required/>