VMM/account: Account.modify accepts a password hash. v0.7.x
authorPascal Volk <user@localhost.localdomain.org>
Sun, 23 Feb 2014 18:00:35 +0000
branchv0.7.x
changeset 735 ddcad86f7386
parent 734 8167ba72235c
child 736 66a5f9a405da
VMM/account: Account.modify accepts a password hash.
VirtualMailManager/account.py
--- a/VirtualMailManager/account.py	Mon Feb 17 23:19:01 2014 +0000
+++ b/VirtualMailManager/account.py	Sun Feb 23 18:00:35 2014 +0000
@@ -261,17 +261,19 @@
     def modify(self, field, value):
         """Update the Account's *field* to the new *value*.
 
-        Possible values for *field* are: 'name' and 'note'.
+        Possible values for *field* are: 'name', 'note' and 'pwhash'.
 
         Arguments:
 
         `field` : str
-          The attribute name: 'name', or 'note'
+          The attribute name: 'name', 'note' or 'pwhash'
         `value` : str
           The new value of the attribute.
         """
-        if field not in ('name', 'note'):
+        if field not in ('name', 'note', 'pwhash'):
             raise AErr(_("Unknown field: '%s'") % field, INVALID_ARGUMENT)
+        if field == 'pwhash':
+            field = 'passwd'
         self._chk_state()
         dbc = self._dbh.cursor()
         dbc.execute('UPDATE users SET %s = %%s WHERE uid = %%s' % field,