18 lines
600 B
Python
18 lines
600 B
Python
from django.core.management.base import BaseCommand, CommandError
|
|
|
|
from apps.sources.services.mailbox_connections import (
|
|
MailboxCredentialError,
|
|
rotate_mailbox_credentials,
|
|
)
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = "Versleutel alle mailbox-app-wachtwoorden opnieuw met de eerste ingestelde sleutel."
|
|
|
|
def handle(self, *args, **options):
|
|
try:
|
|
count = rotate_mailbox_credentials()
|
|
except MailboxCredentialError as exc:
|
|
raise CommandError(str(exc)) from exc
|
|
self.stdout.write(self.style.SUCCESS(f"{count} mailboxcredential(s) geroteerd."))
|