示例#1
0
    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"
示例#2
0
    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"
示例#3
0
文件: poems.py 项目: rje4242/poemtube
 def PATCH(self, urlid):
     user = require_authenticated_user(self.db)
     return do_json(json_poems.PATCH, self.db, clean_id(urlid), web.data(),
                    user)
示例#4
0
文件: poems.py 项目: rje4242/poemtube
 def DELETE(self, urlid):
     user = require_authenticated_user(self.db)
     return do_json(json_poems.DELETE, self.db, clean_id(urlid), user)
示例#5
0
文件: poems.py 项目: rje4242/poemtube
 def POST(self, urlid):
     user = require_authenticated_user(self.db)
     return do_json(json_poems.POST, self.db, web.data(), user)
示例#6
0
 def PATCH( self, urlid ):
     user = require_authenticated_user( self.db )
     return do_json(
         json_poems.PATCH, self.db, clean_id( urlid ), web.data(), user )
示例#7
0
 def DELETE( self, urlid ):
     user = require_authenticated_user( self.db )
     return do_json( json_poems.DELETE, self.db, clean_id( urlid ), user )
示例#8
0
 def POST( self, urlid ):
     user = require_authenticated_user( self.db )
     return do_json( json_poems.POST, self.db, web.data(), user )