def _setcookie(self, session_id, expires='', **kw): cookie_name = self._config.cookie_name cookie_domain = self._config.cookie_domain cookie_path = self._config.cookie_path httponly = self._config.httponly secure = self._config.secure web.setcookie(cookie_name, session_id, expires=expires, domain=cookie_domain, httponly=httponly, secure=secure, path=cookie_path)
def _save(self): cookie_name = self._config.cookie_name cookie_domain = self._config.cookie_domain if not self.get('_killed'): web.setcookie(cookie_name, self.session_id, domain=cookie_domain) self.store[self.session_id] = dict(self) else: web.setcookie(cookie_name, self.session_id, expires=-1, domain=cookie_domain)
def _save(self): cookie_name = self._config.cookie_name cookie_domain = self._config.cookie_domain httponly = self._config.httponly if not self.get("_killed"): web.setcookie(cookie_name, self.session_id, domain=cookie_domain, httponly=httponly) self.store[self.session_id] = dict(self._data) else: web.setcookie(cookie_name, self.session_id, expires=-1, domain=cookie_domain, httponly=httponly)
def render(self): token = uuid.uuid4().hex web.setcookie("CSRF_token", token) self.value = token return super(CSRF_Token, self).render()