Converted indentation to tabs

This commit is contained in:
PhilipTrauner 2015-10-25 18:04:23 +01:00
parent f7811a605d
commit a3d0820d78

View file

@ -4,44 +4,44 @@ import DataTypes
from .AsyncServer import Server
class vHandler(Server.Handler):
def setup(self):
Logging.info("Handler for '%s' initalised." % self.info[0])
self.authed = False
self.users = self.kwargs.pop("users")
def setup(self):
Logging.info("Handler for '%s' initalised." % self.info[0])
self.authed = False
self.users = self.kwargs.pop("users")
def handle(self, data, type):
if not self.authed:
if type == DataTypes.json:
self.auth(data)
def handle(self, data, type):
if not self.authed:
if type == DataTypes.json:
self.auth(data)
def finish(self):
Logging.info("%s disconnected." % self.info[0])
def finish(self):
Logging.info("%s disconnected." % self.info[0])
def auth(self, collection):
if "auth" in collection:
if "user" and "pw" in collection["auth"]:
temp_user = User(collection["auth"]["user"], collection["auth"]["pw"])
if temp_user in self.users:
self.sock.send({"auth" : "success"})
self.authed = True
return
self.sock.close()
def auth(self, collection):
if "auth" in collection:
if "user" and "pw" in collection["auth"]:
temp_user = User(collection["auth"]["user"], collection["auth"]["pw"])
if temp_user in self.users:
self.sock.send({"auth" : "success"})
self.authed = True
return
self.sock.close()
class User:
def __init__(self, username, password):
self.username = username
self.password = password
def __init__(self, username, password):
self.username = username
self.password = password
def __eq__(self, other):
if self.username == other.username and self.password == other.password:
return True
return False
def __eq__(self, other):
if self.username == other.username and self.password == other.password:
return True
return False
def __repr__(self):
return self.username
def __repr__(self):
return self.username
server = Server("127.0.0.1", 1337, vHandler, {"users" : [User("test", "123")]})