Beispiel #1
0
            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)
Beispiel #2
0
					# 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:
					users = dict()
					for row in groupsdb.get_members_for(gid, ['uid']):
Beispiel #3
0
                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))
            else:
                users = userstable.SSUsers(DATABASE)
Beispiel #4
0
    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/>

						<label for="password">Password</label>