Example #1
0
    def processRegister(self, receivedDict):
        '''Register a new user and return it's user id to the ManagerApp'''

        if (self.usernameExists(receivedDict['user'])):
            self.connection.send("INVALID USERNAME".encode())
        else:
            user = receivedDict['user']
            password = receivedDict['password']
            phone = receivedDict['phone']
            mail = receivedDict['mail']
            name = receivedDict['name']
            age = receivedDict['age']

            newManager = Manager(user, password, phone, mail, name, age)
            MANAGERS_LIST.append(newManager)

            data = newManager.getID()
            print("THIS IS THE MANAGER ID {}\n  ".format(data))

            self.connection.send(str(data).encode())