Exemplo n.º 1
0
    def cmd_login(self, data, client, cmd=None):
        """\
        <password> - login a privileged user to his full capabilities
        """
        if client.isvar(self, 'loggedin'):
            client.message('You are already logged in.')
            return

        if not client.isvar(self, 'login_groupbits'):
            client.message('You do not need to log in.')
            return

        if data:
            digest = newmd5(data).hexdigest()
            if digest == client.password:
                client.setvar(self, 'loggedin', 1)
                client.groupBits = client.var(self, 'login_groupbits').value
                client.message('You are successfully logged in.')
                return
            else:
                client.message('^1***Access denied***^7')
                return
        else:
            message = 'Usage (via console): %s %s !login yourpassword' % (
                self._pmcomm, client.cid)
            client.message(message)
            return
Exemplo n.º 2
0
 def cmd_login(self, data, client, cmd=None):
     """\
     <password> - login a privileged user to his full capabilities
     """
     if client.isvar(self, 'loggedin'):
         client.message('You are already logged in.')
         return
     
     if not client.isvar(self, 'login_groupbits'):
         client.message('You do not need to log in.')
         return            
     
     if data:
         digest = newmd5(data).hexdigest()
         if digest == client.password:
             client.setvar(self, 'loggedin', 1)
             client.groupBits = client.var(self, 'login_groupbits').value
             client.message('You are successfully logged in.')
             return
         else:
             client.message('^1***Access denied***^7')
             return
     else:
         message = 'Usage (via console): %s %s !login yourpassword' %(self._pmcomm, client.cid)
         client.message(message)
         return
Exemplo n.º 3
0
    def cmd_setpassword(self, data, client, cmd=None):
        """\
        <password> [<name>] - set a password for a client
        """
        data = string.split(data)
        if len(data) > 1:
            sclient = self._adminPlugin.findClientPrompt(data[1], client)
            if not sclient: return        
            if client.maxLevel <= sclient.maxLevel and client.maxLevel < 100:
                client.message('You can only change passwords of yourself or lower level players.')
                return
        else:
            sclient = client

        sclient.password = newmd5(data[0]).hexdigest()
        self.console.storage.query(QueryBuilder(self.console.storage.db).UpdateQuery( { 'password' : sclient.password }, 'clients', { 'id' : sclient.id } ))
        return
Exemplo n.º 4
0
    def cmd_setpassword(self, data, client, cmd=None):
        """\
        <password> [<name>] - set a password for a client
        """
        data = string.split(data)
        if len(data) > 1:
            sclient = self._adminPlugin.findClientPrompt(data[1], client)
            if not sclient: return
            if client.maxLevel <= sclient.maxLevel and client.maxLevel < 100:
                client.message(
                    'You can only change passwords of yourself or lower level players.'
                )
                return
        else:
            sclient = client

        sclient.password = newmd5(data[0]).hexdigest()
        self.console.storage.query(
            QueryBuilder(self.console.storage.db).UpdateQuery(
                {'password': sclient.password}, 'clients', {'id': sclient.id}))
        return
Exemplo n.º 5
0
def generatePasswordHash(salt, password):
    m = newmd5()
    m.update(salt)
    m.update(password)
    return m.digest()
Exemplo n.º 6
0
def generatePasswordHash(salt, password):
    m = newmd5()
    m.update(salt)
    m.update(password)
    return m.digest()