Example #1
0
 def get(self):
   user = users.get_current_user()
   template_values = {
     # TODO(battlehorse): create logout url based on current request url  
     'logout_url': users.create_logout_url('/'),
   }
   snipglobals.delete_cookie('xsrf_token', self.response)
   snipglobals.delete_cookie('ACSID', self.response,
                             '.%s' % snipglobals.get_domain())
   path = os.path.join(os.path.dirname(__file__), '../../templates/logout.html')
   self.response.out.write(template.render(path, template_values))
Example #2
0
    path = os.path.join(os.path.dirname(__file__), '../../templates/iframe.html')
    self.response.out.write(template.render(path, template_values))


# Serving the snippets iframe from a subdomain, to minimize XSS attacks.
# The pair of domains used depends on the environment where the app is deployed:
# - production:
#   snipbin.appspot.com, hosted.snipbin.appspot.com
#
# - staging (non-live apps deployed on appengine):
#   <app_version>.latest.snipbin.appspot.com, hosted.<app-version>.latest.snipbin.appspot.com
#
# - development (local machine)
#   localhost:8080 for both domains.
if snipglobals.is_localhost():
  domain = snipglobals.get_domain()
  applications = {
    domain: webapp.WSGIApplication(
        [('/view', ViewHandler), ('/inc', IncludeHandler), ('/helper', HelperHandler)],
        debug=snipglobals.debug),
  }
else:
  domain = snipglobals.get_domain()
  hosted_domain = snipglobals.get_hosted_domain()
  applications = {
    domain: webapp.WSGIApplication(
        [('/view', ViewHandler), ('/helper', HelperHandler)],
        debug=snipglobals.debug),
    hosted_domain: webapp.WSGIApplication(
        [('/inc', IncludeHandler)],
        debug=snipglobals.debug),