def get(self): """Serve the form page. """ logging.info('SelfComboPage.GET') logging.info('headers: %s' % self.request.headers.items()) logging.info('params: %s' % self.request.params.items()) logging.info('body: %s' % self.request.body) # Make sure (as best we can) that this is being requested from a site # that's allowed to embed our join form. # This is such a weak check that I'm not sure it's worth it. #if not config.DEBUG: # if not self.request.referer or \ # urlparse(self.request.referer).hostname not in config.ALLOWED_EMBED_REFERERS: # webapp2.abort(403, detail='bad referer') csrf_token = helpers.get_csrf_token(self.request) volunteer_interests = gapps.get_volunteer_interests() skills_categories = gapps.get_skills_categories() template_values = { 'FIELDS': config.FIELDS, 'csrf_token': csrf_token, 'volunteer_interests': volunteer_interests, 'skills_categories': skills_categories, 'config': config, } template = JINJA_ENVIRONMENT.get_template('self-serve-combo.jinja') helpers.set_csrf_cookie(self.response, csrf_token) self.response.write(template.render(template_values))
def get(self): user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) return elif not gapps.is_user_authorized(user): self.redirect('/bad-user') return csrf_token = helpers.get_csrf_token(self.request) volunteer_interests = gapps.get_volunteer_interests() skills_categories = gapps.get_skills_categories() template_values = { 'FIELDS': config.FIELDS, 'csrf_token': csrf_token, 'volunteer_interests': volunteer_interests, 'skills_categories': skills_categories, 'config': config, } template = JINJA_ENVIRONMENT.get_template('renew-member.jinja') helpers.set_csrf_cookie(self.response, csrf_token) self.response.write(template.render(template_values))
def get(self): user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) return elif not gapps.is_user_authorized(user): self.redirect('/bad-user') return csrf_token = helpers.get_csrf_token(self.request) volunteer_interests = gapps.get_volunteer_interests() skills_categories = gapps.get_skills_categories() template_values = { 'FIELDS': config.FIELDS, 'csrf_token': csrf_token, 'volunteer_interests': volunteer_interests, 'skills_categories': skills_categories, 'config': config, } template = JINJA_ENVIRONMENT.get_template('new-member.jinja') helpers.set_csrf_cookie(self.response, csrf_token) self.response.write(template.render(template_values))
def renew_member(): """Show the page where a member can be renewed. """ volunteer_interests = gapps.get_volunteer_interests() skills_categories = gapps.get_skills_categories() resp = flask.make_response( flask.render_template('renew-member.jinja', app_config=config, volunteer_interests=volunteer_interests, skills_categories=skills_categories)) return resp
def volunteer(): """This is the page that new volunteers will fill out in order to join. """ logging.info('self_serve.volunteer') logging.info('headers: %s', list(flask.request.headers.items())) logging.info('values: %s', list(flask.request.values.items())) volunteer_interests = gapps.get_volunteer_interests() skills_categories = gapps.get_skills_categories() resp = flask.make_response( flask.render_template('self-serve-volunteer.jinja', app_config=config, volunteer_interests=volunteer_interests, skills_categories=skills_categories)) return resp
def combo(): """This page has multiple registration types on it (i.e., member and volunteer). """ logging.info('self_serve.combo') logging.info('headers: %s', list(flask.request.headers.items())) logging.info('values: %s', list(flask.request.values.items())) volunteer_interests = gapps.get_volunteer_interests() skills_categories = gapps.get_skills_categories() resp = flask.make_response( flask.render_template('self-serve-combo.jinja', app_config=config, volunteer_interests=volunteer_interests, skills_categories=skills_categories)) return resp