modifié: superTornado.py

This commit is contained in:
sidya82 2014-03-02 22:26:37 +01:00
parent 547879e8f9
commit 70c0d27716

View File

@ -48,14 +48,14 @@ class MainHandler(BaseHandler):
class VideoHandler(BaseHandler):
def get(self):
if not self.get_current_user :
if not self.get_autorisation and not self.get_current_user :
self.redirect("/")
return
self.render("v/video.html")
class UnauthorizedHandler(BaseHandler):
def get(self):
if not self.get_autorisation :
if not self.get_current_user :
self.redirect("/")
return
self.render("v/illegal.html")
@ -77,7 +77,7 @@ class DisconnectionHandler(BaseHandler):
class WSocketHandler(BaseHandler,tornado.websocket.WebSocketHandler):
def open(self) :
if not self.get_autorisation :
if not self.get_autorisation and not self.get_current_user :
self.close()
return
print "->Websocket opened : " + self.request.remote_ip
@ -108,11 +108,10 @@ class WSocketHandler(BaseHandler,tornado.websocket.WebSocketHandler):
def on_close(self):
print "->Websocket closed : "+self.request.remote_ip
if self.get_autorisation == "yes":
iden = self.current_user
if self.get_autorisation == "yes":
ficLog.enregDansLog(iden,"Authorized user deconnection",self.request.remote_ip)
else :
iden="IllegalUser"
ficLog.enregDansLog(iden + " as IllegalUser","Unauthorized user deconnection",self.request.remote_ip)
if confAveug == True: