def GET(self): user = require_authenticated_user(self.db) # TODO: expire old tokens. Maybe we could do it here? token = generate_token() self.db.tokens[token] = {"user": user} web.setcookie("authentication_token", token, expires=36000) # TODO: if/when we use https, make sure this cookie has secure=True # TODO: don't know how to add HttpOnly web.ctx.status = "204 No Content"
def GET( self ): user = require_authenticated_user( self.db ) # TODO: expire old tokens. Maybe we could do it here? token = generate_token() self.db.tokens[token] = { "user": user } web.setcookie( "authentication_token", token, expires=36000 ) # TODO: if/when we use https, make sure this cookie has secure=True # TODO: don't know how to add HttpOnly web.ctx.status = "204 No Content"
def PATCH(self, urlid): user = require_authenticated_user(self.db) return do_json(json_poems.PATCH, self.db, clean_id(urlid), web.data(), user)
def DELETE(self, urlid): user = require_authenticated_user(self.db) return do_json(json_poems.DELETE, self.db, clean_id(urlid), user)
def POST(self, urlid): user = require_authenticated_user(self.db) return do_json(json_poems.POST, self.db, web.data(), user)
def PATCH( self, urlid ): user = require_authenticated_user( self.db ) return do_json( json_poems.PATCH, self.db, clean_id( urlid ), web.data(), user )
def DELETE( self, urlid ): user = require_authenticated_user( self.db ) return do_json( json_poems.DELETE, self.db, clean_id( urlid ), user )
def POST( self, urlid ): user = require_authenticated_user( self.db ) return do_json( json_poems.POST, self.db, web.data(), user )