Skip to content

Commit

Permalink
Bug fix: dont update email passwords on upgrade if crypt detected
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Aug 25, 2019
1 parent a5bf6ca commit dde0ab9
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions plogical/upgrade.py
Expand Up @@ -1583,11 +1583,13 @@ def upgradeDovecot():

writeToFile.close()

if updatePasswords:
for items in EUsers.objects.all():
command = 'doveadm pw -p %s' % (items.password)
items.password = subprocess.check_output(shlex.split(command)).strip('\n')
items.save()
Upgrade.stdOut("Upgrading passwords...")
for items in EUsers.objects.all():
if items.password.find('CRYPT') > -1:
continue
command = 'doveadm pw -p %s' % (items.password)
items.password = subprocess.check_output(shlex.split(command)).strip('\n')
items.save()

command = "systemctl restart dovecot"
Upgrade.executioner(command, 0)
Expand Down Expand Up @@ -1642,12 +1644,14 @@ def upgradeDovecot():

writeToFile.close()

if updatePasswords:
Upgrade.stdOut("Upgrading passwords...")
for items in EUsers.objects.all():
command = 'doveadm pw -p %s' % (items.password)
items.password = subprocess.check_output(shlex.split(command)).strip('\n')
items.save()
Upgrade.stdOut("Upgrading passwords...")
for items in EUsers.objects.all():
if items.password.find('CRYPT') > -1:
continue
command = 'doveadm pw -p %s' % (items.password)
items.password = subprocess.check_output(shlex.split(command)).strip('\n')
items.save()


command = "systemctl restart dovecot"
Upgrade.executioner(command, 0)
Expand Down

0 comments on commit dde0ab9

Please sign in to comment.