diff options
author | Teddy <[email protected]> | 2013-08-23 08:30:32 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2013-08-23 08:30:32 +0800 |
commit | d622bf0bd855f4d2f0600a52aba1faa015f91ac6 (patch) | |
tree | bc5bf42db50b55be4d6f58894eb8863c423fa50f /server/piztor_server.py | |
parent | b6e5eac9702e8fb1c47aebddd613933706a0a36a (diff) |
...
Diffstat (limited to 'server/piztor_server.py')
-rw-r--r-- | server/piztor_server.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/piztor_server.py b/server/piztor_server.py index 924e268..a19989a 100644 --- a/server/piztor_server.py +++ b/server/piztor_server.py @@ -51,7 +51,7 @@ class UserManager(DataManager): Base.metadata.create_all(engine) self.active_sessions = dict() - def authentication_handle(self, opt_type, data): + def authentication_handle(self, opt_type, data, srv): print "Parsing User Data" pos = -1 for i in xrange(0, len(data)): @@ -69,11 +69,17 @@ class UserManager(DataManager): print "Trying to login with following info:" print (username, password) + session = Session() + q = session.query(User).filter(User.username == username) + entry = q.first() + if entry.password != password: # Auth failed + return struct.pack("!BL" + return struct.pack("!BL", 0, 1234) class MesgManager(DataManager): - def mesg_sending_handle(self, opt_type, data): + def mesg_sending_handle(self, opt_type, data, srv): print "Parsing Mesg Data" try: if len(data) < 8: @@ -86,7 +92,7 @@ class MesgManager(DataManager): raise ReqInvalidError() class LocationManager(DataManager): - def location_update_handle(self, opt_type, data): + def location_update_handle(self, opt_type, data, srv): print "Parsing Loc Data" try: if len(data) < 8: |