my app.cfg
...
# The password encryption algorithm used when comparing passwords
against what's
# stored in the database. Valid values are 'md5' or 'sha1'. If you do
not
# specify an encryption algorithm, passwords are expected to be clear
text.
#
# The SqlAlchemyProvider *will* encrypt passwords supplied as part of
your login
# form. If you set the password through the password property, like:
# my_user.password = 'secret'
# the password will be encrypted in the database, provided identity is
up and
# running, or you have loaded the configuration specifying what
encryption to
# use (in situations where identity may not yet be running, like
tests).
identity.saprovider.encryption_algorithm="sha1"
...
The problem is in the initial setting of passwords. The passwords
getting checked work just fine once they are in there. SQLObject
handled this in the User class definition:
class User(SQLObject):
"""
Reasonably basic User definition. Probably would want additional
attributes.
"""
# names like "Group", "Order" and "User" are reserved words in SQL
# so we set the name to something safe for SQL
class sqlmeta:
table="tg_user"
user_name = UnicodeCol( length=16, alternateID=True,
alternateMethodName="by_user_name" )
email_address = UnicodeCol( length=255, alternateID=True,
alternateMethodName="by_email_address" )
display_name = UnicodeCol( length=255 )
password = UnicodeCol( length=40 )
created = DateTimeCol( default=datetime.now )
enabled = BoolCol()
# groups this user belongs to
groups = RelatedJoin( "Group", intermediateTable="user_group",
joinColumn="user_id", otherColumn="group_id" )
def _get_permissions( self ):
perms = set()
for g in self.groups:
perms = perms | set(g.permissions)
return perms
def _set_password( self, cleartext_password ):
"Runs cleartext_password through the hash algorithm before
saving."
hash = identity.encrypt_password(cleartext_password)
self._SO_set_password(hash)
def set_password_raw( self, password ):
"Saves the password as-is to the database."
self._SO_set_password(password)
So, how do I get SqlAlchemy (with activemapper) to do the
setpassword/getpassword fun stuff?
TIA
-chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---