Пример #1
0
    def login(self, request):

        CSRF.setToken(request)

        with open("loginpage.html") as f:
            loginPage = f.read()
        return TextResponse(loginPage)
Пример #2
0
    def login(self, request):

        CSRF.setToken(request)

        with open("loginpage.html") as f:
            loginPage = f.read()
        return TextResponse(loginPage)
Пример #3
0
    def login_POST(self, request):

        if CSRF.checkToken(request):
            authCookie = yield self.db.checkAuth(request.args["user"], request.args["password"])

            if authCookie:
                request.setCookie("SESSION", authCookie)
                defer.returnValue(Redirect())
            else:
                response = TextResponse(u"login failed")
                response.setCode(400)
                defer.returnValue(response)
        else:
            response = TextResponse(u"CSRF failed")
            response.setCode(400)
            defer.returnValue(response)
Пример #4
0
    def login_POST(self, request):

        if CSRF.checkToken(request):
            authCookie = yield self.db.checkAuth(request.args["user"],
                                                 request.args["password"])

            if authCookie:
                request.setCookie("SESSION", authCookie)
                defer.returnValue(Redirect())
            else:
                response = TextResponse(u"login failed")
                response.setCode(400)
                defer.returnValue(response)
        else:
            response = TextResponse(u"CSRF failed")
            response.setCode(400)
            defer.returnValue(response)