Example #1
0
			</ul>
			<p><h3>Allow Target Assignment Rules</h3></p>
			<ul>
				<li>Household exclusion</li>
				<li>Location exclusions</li>
				<li>Age matching</li>
			</ul>
			<p><h3>Registries</h3></p>
			<ul>
				<li>List of present ideas</li>
				<li>Claim purchase</li>
			</ul>"""
    if loggedin:
        DATA += """<p align="center"><br/><button><a href="{}">Create a Group Now</a></button></p>
			<p class="footnote">Website designed by Brian Hession</p>""".format(
            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',
Example #2
0
import sshttp

try:
    import sessions, sshtml, userstable

    if sessions.session_is_valid():
        DATA = """<h1>Welcome, {}!</h1>
			<p align="center">Your email: {}</p>
			<p align="center"><a href="{}">change name</a> | <a href="{}">change password</a></p>
			<p align="center"><a href="/signout.py"><br/>Sign out</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>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)
Example #3
0
                        error = ERROR.format('User does not exist')
                    MODERATOR_MEMBER_DATA = """<hr/>
						<form id="addMember" action="/groupctl.py" method="post">
							<input type="text" placeholder="Enter user's email" name="email" required/>
							{error}
							<input type="hidden" name="gid" value="{gid}"/>
							<input type="hidden" name="addmember" value="1"/>
							<button><a href="javascript:void(0);" onclick="document.getElementById('addMember').submit()">Add Member</a></button>
						</form>
						<hr/>
						<form id="runSecretSanta" action="/groupctl.py" method="post">
							<input type="hidden" name="gid" value="{gid}"/>
							<button><a href="{link}">Run Secret Santa Assignment</a></button>
						</form>""".format(gid=gid,
                        error=error,
                        link=sshttp.build_redirect_uri(
                            '/getacc.py', '/ssctl.py?gid={}'.format(gid)))
                ADMIN_MEMBER_DATA = ''
                if level >= groupstable.ADMIN:
                    ERROR = '<p style="font-size: 14px;margin-top: 0; margin-bottom: 15px;"><font color="#a93226">{}</font><br/></p>'
                    error = ''
                    if 'nopassword' in args:
                        error = ERROR.format('Must provide a password')
                    elif 'invalid' in args:
                        error = ERROR.format('Invalid password')
                    ADMIN_MEMBER_DATA = """<hr/>
						<form id="deleteGroup" action="/groupctl.py" method="post">
							<input type="hidden" name="gid" value="{gid}"/>
							<input type="hidden" name="deletegroup" value="1"/>
							<input type="password" placeholder="Enter your password" name="password"/>
							{error}
							<button class="warning"><a href="javascript:void(0);" onclick="document.getElementById('deleteGroup').submit()">Delete Group</a></button>
Example #4
0
			<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>'

            ERROR = '<p><font color="#a93226">{}</font><br/></p>'

            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():
Example #5
0
#

from env import *
import datetime
import sshttp

try:
    import sessions

    args = sshttp.get_parameters()
    redirect = sshttp.get_redirect()

    if sessions.session_is_valid():
        if redirect:
            sshttp.send302(redirect)
        else:
            sshttp.send302('/')
    elif sshttp.has_cookies():
        sshttp.send302(sshttp.build_redirect_uri('/signin.py', redirect),
                       headers={
                           'Set-Cookie':
                           'ssid=expired; Secure; Expires="{}"'.format(
                               datetime.datetime.utcfromtimestamp(0))
                       })
    else:
        sshttp.send302(sshttp.build_redirect_uri('/signin.py', redirect))
except:
    sshttp.senderror(500)
    import sys, traceback
    traceback.print_exc(file=sys.stderr)