Bug fix: dont update email passwords on upgrade if crypt detected

This commit is contained in:
Usman Nasir
2019-08-25 14:06:28 +05:00
parent a5bf6ca60a
commit dde0ab908e

View File

@@ -1583,11 +1583,13 @@ enabled=1"""
writeToFile.close() writeToFile.close()
if updatePasswords: Upgrade.stdOut("Upgrading passwords...")
for items in EUsers.objects.all(): for items in EUsers.objects.all():
command = 'doveadm pw -p %s' % (items.password) if items.password.find('CRYPT') > -1:
items.password = subprocess.check_output(shlex.split(command)).strip('\n') continue
items.save() command = 'doveadm pw -p %s' % (items.password)
items.password = subprocess.check_output(shlex.split(command)).strip('\n')
items.save()
command = "systemctl restart dovecot" command = "systemctl restart dovecot"
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)
@@ -1642,12 +1644,14 @@ enabled=1"""
writeToFile.close() writeToFile.close()
if updatePasswords: Upgrade.stdOut("Upgrading passwords...")
Upgrade.stdOut("Upgrading passwords...") for items in EUsers.objects.all():
for items in EUsers.objects.all(): if items.password.find('CRYPT') > -1:
command = 'doveadm pw -p %s' % (items.password) continue
items.password = subprocess.check_output(shlex.split(command)).strip('\n') command = 'doveadm pw -p %s' % (items.password)
items.save() items.password = subprocess.check_output(shlex.split(command)).strip('\n')
items.save()
command = "systemctl restart dovecot" command = "systemctl restart dovecot"
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)