Beispiel #1
0
    def verify_csrf(self, request):
        a = request.get("query", {})
        csrf_token_a = a.get("csrfmiddlewaretoken")
        csrf_token_b = webapp.get_cookie(request, "csrftoken")
        if csrf_token_a != csrf_token_b or not csrf_token_b:
            return False

        return True
Beispiel #2
0
 def selected_lang(self):
   
   """
   Return the currently selected language in the cookie
   
   If no language is selected in the cookie return the default language
   for the session
   """
   
   return webapp.get_cookie(self.request, "lang", self.ses.locale.lang)
Beispiel #3
0
  def selected_theme(self):
    
    """
    Return the currently selected theme in the cookie

    If no theme is selected in the cookie return the default theme for the
    session
    """
    
    return webapp.get_cookie(self.request, "theme", self.ses.theme)
Beispiel #4
0
 def csrf_token(self):
   return webapp.get_cookie(self.request, "csrftoken", "")