[Zope] SimpleUserFolder and sha-crypted passwd
Adam Manock
abmanock@earthlink.net
18 Dec 2002 14:00:30 -0500
On Mon, 2002-12-16 at 05:23, Bj=C3=B8rge Solli wrote:
> Hi
>=20
> I want to put my old loginmanager to rest and put something simple in.=20
> SimpleUserFolder sounds nice, but it seems to do the password matching=20
> itself, and since I have sha-crypted passwords, I need to match the=20
> passwords in encrypted format. Any ideas? If none, can u please tell me t=
o=20
> *not* use SimpleUserFolder(perhaps you have an alternative as well?).
>=20
> For the record; I keep my users in a database.
>=20
> Thankyou!
>=20
I've been down that road...
SHA should work roughly the same as MD5 below
Adam
>From exUserFolder/pgAuthSourceAlt/pgAuthSource.py
# Original cryptPassword function
def cryptPassword(self, username, password):
salt =3Dusername[:2]
secret =3D crypt(password, salt)
return secret
# Alternate cryptPassword function, returns md5 hash of the password
# def cryptPassword(self, username, password):
# passhash =3D md5.new(password)
# secret =3D passhash.hexdigest()
# return secret
# Alternate cryptPassword function, returns plain text of the password.
# def cryptPassword(self, username, password):
# return password