Source

iredadmin-ose / libs / pgsql / admin.py

Diff from to

File libs/pgsql/admin.py

 # Author: Zhang Huangbin <zhb@iredmail.org>
 
 import web
-from libs import iredutils, settings
+import settings
+from libs import iredutils
 from libs.pgsql import core, decorators, connUtils
 
-cfg = web.iredconfig
 session = web.config.get('_session')
 
 
         sql_vars = {'admin': self.admin, 'domains': self.domains, }
         if accountType == 'domain':
             try:
-                if self.isGlobalAdmin(self.admin):
+                if self.is_global_admin(self.admin):
                     result = self.conn.select('domain', what='COUNT(domain) AS total',)
                 else:
                     result = self.conn.query(
                 pass
         elif accountType == 'user':
             try:
-                if self.isGlobalAdmin(self.admin):
+                if self.is_global_admin(self.admin):
                     if len(self.domains) >= 0:
                         result = self.conn.select(
                             'mailbox',
                 pass
         elif accountType == 'alias':
             try:
-                if self.isGlobalAdmin(self.admin):
+                if self.is_global_admin(self.admin):
                     if len(self.domains) == 0:
                         result = self.conn.select(
                             'alias',
                 limit=1,
             )
             if len(result) == 1:
-                if self.isGlobalAdmin(admin=self.mail):
+                if self.is_global_admin(admin=self.mail):
                     self.domainGlobalAdmin = True
 
                 return (True, self.domainGlobalAdmin, list(result)[0])
         self.newpw = web.safestr(data.get('newpw'))
         self.confirmpw = web.safestr(data.get('confirmpw'))
 
-        result = iredutils.verifyNewPasswords(self.newpw, self.confirmpw)
+        result = iredutils.verify_new_password(self.newpw, self.confirmpw)
 
         if result[0] is True:
             self.passwd = result[1]
                 name=self.cn,
                 password=iredutils.generate_password_for_sql_mail_account(self.passwd),
                 language=self.preferredLanguage,
-                created=iredutils.getGMTTime(),
+                created=iredutils.get_gmttime(),
                 active='1',
             )
 
                     'domain_admins',
                     username=self.mail,
                     domain='ALL',
-                    created=iredutils.getGMTTime(),
+                    created=iredutils.get_gmttime(),
                     active='1',
                 )
 
             self.confirmpw = web.safestr(data.get('confirmpw', ''))
 
             # Verify new passwords.
-            qr = iredutils.verifyNewPasswords(self.newpw, self.confirmpw)
+            qr = iredutils.verify_new_password(self.newpw, self.confirmpw)
             if qr[0] is True:
                 self.passwd = iredutils.generate_password_for_sql_mail_account(qr[1])
             else:
                     vars=sql_vars,
                     where='username=$username',
                     password=self.passwd,
-                    passwordlastchange=iredutils.getGMTTime(),
+                    passwordlastchange=iredutils.get_gmttime(),
                 )
             except Exception, e:
                 raise web.seeother('/profile/admin/password/%s?msg=%s' % (self.mail, web.urlquote(e)))