Changeset 3218

Show
Ignore:
Timestamp:
07/03/07 11:18:02 (1 year ago)
Author:
faide
Message:

Adds encryption on the fly for SA identity on in the template as per discussion here:
http://groups.google.co.in/group/turbogears/browse_thread/thread/f4b43e9f148c3a9a
fixes ticket #1415

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/turbogears/qstemplates/quickstart/+package+/model.py_tmpl

    r3205 r3218  
    239239    by_user_name = classmethod(by_user_name) 
    240240 
     241    def _set_password(self, password): 
     242        ''' 
     243        encrypts password on the fly using the encryption 
     244        algo defined in the configuration 
     245        ''' 
     246        self._password = identity.encrypt_password(password) 
     247 
     248    def _get_password(self): 
     249        ''' 
     250        returns password 
     251        ''' 
     252        return self._password 
     253 
     254    password = property(_get_password, _set_password) 
     255 
    241256class Permission(object): 
    242257    """ 
     
    252267assign(VisitIdentity, visit_identity_table, 
    253268          properties=dict(users=relation(User, backref='visit_identity'))) 
    254 assign(User, users_table) 
     269assign(User, users_table, 
     270        properties=dict(_password=users_table.c.password)) 
    255271assign(Group, groups_table, 
    256           properties=dict(users=relation(User, secondary=user_group_table, backref='groups'))) 
     272          properties=dict(users=relation(User, 
     273                secondary=user_group_table, backref='groups'))) 
    257274assign(Permission, permissions_table, 
    258           properties=dict(groups=relation(Group, secondary=group_permission_table, backref='permissions'))) 
     275          properties=dict(groups=relation(Group, 
     276                secondary=group_permission_table, backref='permissions'))) 
    259277#else 
    260278#