eve-sqlalchemy icon indicating copy to clipboard operation
eve-sqlalchemy copied to clipboard

some thing is missing in documents

Open amoyiki opened this issue 6 years ago • 2 comments

I want to run Authentication example code with python3, but not work and raise Unicode-objects must be encoded before hashin

def encrypt(self, password):
        """Encrypt password using hashlib and current salt.
        """
        return str(hashlib.sha1(password + str(self.salt))\
            .hexdigest())

i think above code Should be changed to

def encrypt(self, password):
        """Encrypt password using hashlib and current salt.
        """
        return str(hashlib.sha1((password + str(self.salt)).encode('utf8')).hexdigest())

btw, raise an AttributeError: 'User' object has no attribute 'salt' When i use user.check_password(password) in login method, because current obj has not salt

amoyiki avatar Dec 19 '17 07:12 amoyiki

Oh well, these examples indeed have not been touched for a long time :). If you have a working solution by now, would me mind creating a PR with a new runnable example in the examples/ directory?

dkellner avatar Dec 20 '17 19:12 dkellner

@dkellner of course

amoyiki avatar Dec 21 '17 23:12 amoyiki