Thanks for the help! Still looking for that HOWTO.txt
So, now I have a UserSource Installed into my LoginManager. It is called
"pgcrypt" and is supposed to authenticate to a SQL database. The password
stored in the DB is encryputed using the same scheme. Any ideas why it
doesn't let me in? Is there any way to troubleshoot this? It seems like
there should be a way to tell if it's going to work or not form the
management interface.
Here's what I added to UserSources.py:
class PGCryptUserSource(BasicUserSource):
""" A sql based encrypted user source """
meta_type="PG Crypt User Source"
__plugin_kind__="User Source"
def retrieveItem(self, name):
self.getcustbyusername(username=name)
def rolesForUser(self, user):
name = user.getUserName()
res = self.getcustbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
roles=res[0][fields2index['roles']]
return roles
def domainsForUser(self, user):
name = user.getUserName()
res = self.getcustbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
domains=res[0][fields2index['domains']]
return domains
def authenticateUser(self, user, password, request):
name = user.getUserName()
res = self.getcustbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
passwd=res[0][fields2index['password']]
if crypt.crypt(password,'ab')==passwd:
return 1
else:
return 0
+++++
context.registerPlugInClass(
PGCryptUserSource,
permission = 'Add PGCrypt UserSource',
constructors = defaultConstructors(PGCryptUserSource,globals()),
)
_______________________________________________
Zope maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )