Example #1
0
    def make_user(self, **data):
        password = '******' in data and data['password'] or None

        del data['password']

        assert password, 'The password must be provided.'

        u = User(**data)

        u.salt   = self.generate_hash(Enigma.instance().random_number(), time())
        u.secret = self.generate_hash(u.email, u.salt)
        u.hash   = self.generate_hash(password, u.salt)

        return u
Example #2
0
 def generate(password, salt):
     return Enigma.instance().hash(password, salt)
Example #3
0
 def generate_hash(self, primary_factor, secondary_factor):
     return Enigma.instance().hash('%s %s' % (primary_factor, secondary_factor))
Example #4
0
    def generate(self):
        key = '%s/%s' % (AppSettings['cookie_secret'], time())\
            if 'cookie_secret' in AppSettings\
            else str(time())

        return Enigma.instance().hash(key)
Example #5
0
 def set_password(self, password):
     self.hash = Enigma.instance().hash('%s %s' % (password, self.salt))