예제 #1
0
 def test_hash_pwd(self):
     pwd = 'fourty-two'
     for m in crypto.methods:
         h = crypto.hash_pwd(pwd, m)
         if m != 'plain':
             self.assertNotEqual(h.rsplit('$')[-1], pwd)
         self.assertNotEqual(h, pwd)
         self.assertEqual(crypto.check_pwd(h, pwd), True)
예제 #2
0
 def register(self, evt):
     d = evt['data']
     p = Player(d['login'], crypto.hash_pwd(d['passwd']),
                d['real_name'], d['email'])
     if self.factory.database.login_available(d['login']):
         with self.factory.database.transaction as session:
             session.save(p)
         self.send('REGISTERED')
     else:
         self.send('REGFAILED')