I'm relatively new to Django, so please be gentle. :)

I'm trying to implement an http credential management module.
Something along the lines of Firefox's password management, that
stores (host,realm,user,password) in one model for use in http
requests.  The passwords are encrypted using an encryption key, which
is stored in another model, along with a password hash of a user-
supplied password:

class AuthManager(models.Model):
    masterPasswordHash = CharField(max_length=300) # contains hash of
user password
    encryptionKey = CharField(max_length=300) # encryption key,
encrypted with user password

This model has methods for "unlocking", which store the decrypted
encryption key for use in accessing
the encrypted http passwords.  This decrypted key can be erased
according to policy, after which time
the user must re-enter the master password to use the password
manager.

I would like to make sure that these fields are not easily
changeable.  Right now, I can start up a shell and do something like:

  mgr = AuthManager.objects.all()[0]
  mgr.masterPasswordHash = 'a new hash'
  mgr.save()

Ideally, the only way to change these fields would be through a method
in the AuthManager that makes sure it is unlocked before changing the
password (which really requires changing both fields at once).
Attempts to set them directly from outside the class should probably
raise exceptions.

What's the best way to accomplish this?  I tried subclassing CharField
and overriding __set__, this didn't work.

Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to