Esempio n. 1
0
def signout_(request):
    if request.web_input(token="").token != define.get_token()[:8]:
        return Response(define.errorpage(request.userid, errorcode.token), status=403)

    login.signout(request)

    raise HTTPSeeOther(location="/", headers=request.response.headers)
Esempio n. 2
0
def signout_(request):
    if request.web_input(token="").token != define.get_token()[:8]:
        raise WeasylError('token')

    login.signout(request)

    raise HTTPSeeOther(location="/", headers=request.response.headers)
Esempio n. 3
0
def signout_(request):
    if request.web_input(token="").token != define.get_token()[:8]:
        return Response(define.errorpage(request.userid, errorcode.token))

    login.signout(request)

    raise HTTPSeeOther(location="/", headers=request.response.headers)
Esempio n. 4
0
    def GET(self):
        if api.is_api_user():
            raise web.webapi.Forbidden()
        if web.input(token="").token != define.get_token()[:8]:
            return define.errorpage(self.user_id, errorcode.token)

        login.signout(self.user_id)

        raise web.seeother("/index")
Esempio n. 5
0
    def GET(self):
        if api.is_api_user():
            raise web.webapi.Forbidden()
        if web.input(token="").token != define.get_token()[:8]:
            return define.errorpage(self.user_id, errorcode.token)

        login.signout(self.user_id)

        raise web.seeother("/index")
Esempio n. 6
0
    def wrapper(self, *a, **kw):
        form = web.input(token="")

        if not api.is_api_user() and form.token != d.get_token():
            self.user_id = 0

        web.header('Content-Type', 'application/json')
        try:
            return f(self, *a, **kw)
        except WeasylError as e:
            if web.ctx.status == '200 OK':
                web.ctx.status = '403 Forbidden'
            e.render_as_json = True
            raise
        except Exception as e:
            # double underscore here to try to not conflict with any attributes
            # already set on the exception, since we don't know where it's been.
            e.__render_as_json = True
            raise
Esempio n. 7
0
 def inner(request):
     if not weasyl.api.is_api_user() and request.params.get('token', "") != define.get_token():
         return Response(define.errorpage(request.userid, errorcode.token))
     return view_callable(request)
Esempio n. 8
0
 def inner(request):
     if not weasyl.api.is_api_user() and request.params.get(
             'token', "") != define.get_token():
         return Response(define.errorpage(request.userid, errorcode.token))
     return view_callable(request)