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 = '' if 'noemail' in args: 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:
<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)
formatting = ERROR.format('No combination of targets exist with the privided rules.') # Populate list userlist = list() for row in groupsdb.get_members_for(gid, ['uid']): user = usersdb.get_user_by_id(row[0], cols=['id', 'name']) if user: userlist.append(LIST_ITEM.format(uid=user[0], name=user[1])) replace = { 'resources' : sshtml.buildResources({ '/css/secretsanta.css' : 'stylesheet', '/js/secretsanta.js' : 'javascript' }), 'desktopNavLinks' : sshtml.buildDesktopNavLinks(), 'navLinks' : sshtml.buildNavLinks(), 'accountLinks' : sshtml.buildAccountLinks(True), 'body' : sshtml.buildBody(data=DATA.format(gid=gid, userlist=userlist, error=formatting), aside=ASIDE, mobile=MOBILE) } sshttp.send200(sshtml.buildContainerPage(replace)) # Run secretsanta elif sshttp.is_post(): # Verify permissions level = groupsdb.get_membership_level(gid, uid) if level == None or level < groupstable.MOD: sshttp.senderror(403) # All good else:
import sessions, sshtml loggedin = sessions.session_is_valid() DATA = '<h1>Support</h1><p>Please contact Brian Hession.</p>' ASIDE = """ <h2>What is it?</h2> <p>Support page</p> <h2 style="margin-top: 15px;">How does it work?</h2> <p>Reach out to me if there are any technical issues. There is currently no support portal.</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('Support'), 'navLinks': sshtml.buildNavLinks('Support'), '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)
else: DATA = '<h3>You have no groups</h3>' ASIDE = """<h2>What is it?</h2> <p>Your groups are listed here. Whatever shows up are groups you have either created or been invited to.</p> <h2 style="margin-top: 15px;">How does it work?</h2> <p>Choose a group from the list and it will show you the members and your assigned secret santa target, if they have been assigned. If no group shows up, create one now!</p> <p>Only group owners and moderators can assign the targets so wait for one of them to kick it off!</p> <p>Moderators can add and remove group members. Only owners can set moderators and delete the group.</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('Groups'), 'navLinks': sshtml.buildNavLinks('Groups'), 'accountLinks': sshtml.buildAccountLinks(True), 'body': sshtml.buildMenuBody(menu=menu, data=DATA, aside=ASIDE, mobile=MOBILE) } sshttp.send200(sshtml.buildContainerPage(replace)) else: sshttp.senderror(403) except: sshttp.senderror(500) import sys, traceback
'/groupctl.py?creategroup=1')) else: DATA += """<h2>Create your group today!</h2> <p align="center" style="margin: 15px;"><button><a href="/getacc.py">Sign in</a></button></p> <p align="center" style="margin-top: 15px;">Or if you do not have an account, <a href="/register.py">register now</a></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('Home'), 'navLinks': sshtml.buildNavLinks('Home'), '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)
import sessions, sshtml loggedin = sessions.session_is_valid() DATA = '<h1 style="text-align: center">Under construction</h1><p style="font-size: 256px;text-align: center"><i class="fas fa-tools"></i></p>' ASIDE = """ <h2>What?</h2> <p>Secret santa registration and group planner.</p> <h2 style="margin-top: 15px;">How?</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('Registry'), 'navLinks': sshtml.buildNavLinks('Registry'), '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)