Files
VacatureRadar/apps/sources/management/commands/rotate_mailbox_credentials.py
T
2026-07-22 05:12:07 +02:00

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."))