VirtualMailManager/Account.py
branchv0.6.x
changeset 276 f2ecfe0a0e09
parent 275 524f7ed5ad5b
child 290 e2785e04f92e
equal deleted inserted replaced
275:524f7ed5ad5b 276:f2ecfe0a0e09
   242         else:
   242         else:
   243             sieve_col = 'managesieve'
   243             sieve_col = 'managesieve'
   244         self._prepare(MailLocation(format=cfg_dget('mailbox.format')))
   244         self._prepare(MailLocation(format=cfg_dget('mailbox.format')))
   245         sql = "INSERT INTO users (local_part, passwd, uid, gid, mid, tid,\
   245         sql = "INSERT INTO users (local_part, passwd, uid, gid, mid, tid,\
   246  smtp, pop3, imap, %s) VALUES ('%s', '%s', %d, %d, %d, %d, %s, %s, %s, %s)" % (
   246  smtp, pop3, imap, %s) VALUES ('%s', '%s', %d, %d, %d, %d, %s, %s, %s, %s)" % (
   247             sieve_col, self._addr.localpart, pwhash(self._passwd), self._uid,
   247             sieve_col, self._addr.localpart, pwhash(self._passwd,
   248             self._domain.gid, self._mid, self._transport.tid,
   248                                                     user=self._addr),
       
   249             self._uid, self._domain.gid, self._mid, self._transport.tid,
   249             cfg_dget('account.smtp'), cfg_dget('account.pop3'),
   250             cfg_dget('account.smtp'), cfg_dget('account.pop3'),
   250             cfg_dget('account.imap'), cfg_dget('account.sieve'))
   251             cfg_dget('account.imap'), cfg_dget('account.sieve'))
   251         dbc = self._dbh.cursor()
   252         dbc = self._dbh.cursor()
   252         dbc.execute(sql)
   253         dbc.execute(sql)
   253         self._dbh.commit()
   254         self._dbh.commit()
   271             raise AErr(_(u"Unknown field: '%s'") % field, INVALID_AGUMENT)
   272             raise AErr(_(u"Unknown field: '%s'") % field, INVALID_AGUMENT)
   272         self._chk_state()
   273         self._chk_state()
   273         dbc = self._dbh.cursor()
   274         dbc = self._dbh.cursor()
   274         if field == 'password':
   275         if field == 'password':
   275             dbc.execute('UPDATE users SET passwd = %s WHERE uid = %s',
   276             dbc.execute('UPDATE users SET passwd = %s WHERE uid = %s',
   276                         pwhash(value), self._uid)
   277                         pwhash(value, user=self._addr), self._uid)
   277         elif field == 'transport':
   278         elif field == 'transport':
   278             if value != self._transport.transport:
   279             if value != self._transport.transport:
   279                 self._transport = Transport(self._dbh, transport=value)
   280                 self._transport = Transport(self._dbh, transport=value)
   280                 dbc.execute('UPDATE users SET tid = %s WHERE uid = %s',
   281                 dbc.execute('UPDATE users SET tid = %s WHERE uid = %s',
   281                             self._transport.tid, self._uid)
   282                             self._transport.tid, self._uid)