modifié: superTornado.py
This commit is contained in:
parent
533ba50ae0
commit
f2f68e1918
@ -2,8 +2,10 @@ import tornado.ioloop
|
|||||||
import tornado.web
|
import tornado.web
|
||||||
import tornado.httpserver
|
import tornado.httpserver
|
||||||
from loadConf import *
|
from loadConf import *
|
||||||
|
from login import *
|
||||||
|
|
||||||
confAveug = False
|
confAveug = False
|
||||||
|
ficLog = Login()
|
||||||
|
|
||||||
class MainHandler(tornado.web.RequestHandler):
|
class MainHandler(tornado.web.RequestHandler):
|
||||||
def get(self):
|
def get(self):
|
||||||
@ -11,14 +13,40 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
def post(self):
|
def post(self):
|
||||||
iden = self.get_argument("id","")
|
iden = self.get_argument("id","")
|
||||||
mdp = self.get_argument("mdp","")
|
mdp = self.get_argument("mdp","")
|
||||||
self.write("Le pseudo est :")
|
|
||||||
self.write(iden)
|
login = Login()
|
||||||
|
autorise = login.connexion(iden, mdp)
|
||||||
|
#maison = httplib.HTTPConnection("192.168.16.150", 80)
|
||||||
|
if autorise == True:
|
||||||
|
ficLog.enregDansLog(iden,"Authorized user connection",info[0])
|
||||||
|
if confAveug == True:
|
||||||
|
print '->Send audio alarm authorized user'
|
||||||
|
print 'maison.request("GET", "micom/say.php?source=toto&text=Connection%20a%20la%20camera%20autorisee")'
|
||||||
|
else:
|
||||||
|
print '->Send visual alarm authorized user'
|
||||||
|
print 'maison.request("GET", "micom/lamp.php?room=salon1&order=1")'
|
||||||
|
print "->Send to client authorized user access"
|
||||||
|
#redirection autorisé
|
||||||
|
|
||||||
|
else:
|
||||||
|
ficLog.enregDansLog(iden,"Unauthorized user connection",info[0])
|
||||||
|
if confAveug == True:
|
||||||
|
print '->Send audio alarm unauthorized user'
|
||||||
|
print 'maison.request("GET", "micom/say.php?source=toto&text=Connection%20a%20la%20camera%20non%20autorisee")'
|
||||||
|
else:
|
||||||
|
print '->Send visual alarm unauthorized user'
|
||||||
|
print 'maison.request("GET", "micom/lamp.php?room=salon1&order=1")'
|
||||||
|
print "->Send to client unauthorized user access"
|
||||||
|
#redirection non autorisé
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
application = tornado.web.Application([
|
application = tornado.web.Application([
|
||||||
(r"/", MainHandler),
|
(r"/", MainHandler),
|
||||||
|
(r"/video", VideoHandler),
|
||||||
|
(r"/authorized", VideoHandler),
|
||||||
])
|
])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Reference in New Issue
Block a user