Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43e9028f authored by Akhil's avatar Akhil 🙂
Browse files

Merge branch 'dev/purge-disposable-domains' into 'main'

Add command to purge disposable domains file

See merge request !108
parents ac9c9756 10709bce
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
		<command>OCA\EmailRecovery\Command\UpdateBlacklistedDomains</command>
		<command>OCA\EmailRecovery\Command\CreatePopularDomain</command>
		<command>OCA\EmailRecovery\Command\SpamAccountDetection</command>
		<command>OCA\EmailRecovery\Command\ResetDisposableDomainsList</command>
		<command>OCA\EmailRecovery\Command\RecoveryWarningNotificationCommand</command>
	</commands>
</info>
+5 −5
Original line number Diff line number Diff line
@@ -5,19 +5,19 @@ declare(strict_types=1);
namespace OCA\EmailRecovery\Command;

use OCA\EmailRecovery\AppInfo\Application;
use OCA\EmailRecovery\Service\RecoveryEmailService;
use OCA\EmailRecovery\Service\NotificationService;
use OCA\EmailRecovery\Service\RecoveryEmailService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Mail\IMailer;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
use OCP\Notification\IManager;
use OCP\IURLGenerator;
use OCP\AppFramework\Utility\ITimeFactory;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class RecoveryWarningNotificationCommand extends Command {
	private IConfig $config;
+34 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace OCA\EmailRecovery\Command;

use OCA\EmailRecovery\AppInfo\Application;
use OCA\EmailRecovery\Service\DomainService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ResetDisposableDomainsList extends Command {
	public function __construct(private DomainService $domainService) {
		parent::__construct();
	}

	protected function configure() {
		$this
			->setName(Application::APP_ID.':reset-disposable-domains-list')
			->setDescription('Reset disposable domains file');
	}

	protected function execute(InputInterface $input, OutputInterface $output): int {
		try {
			$this->domainService->resetCustomDisposableDomains();
			$output->writeln('Custom disposable domains list has been reset!');
			return 0;
		} catch (\Throwable $e) {
			$output->writeln('Error while resetting custom disposable domains list: ' . $e->getMessage());
			return 1;
		}
	}
}
+1 −1
Original line number Diff line number Diff line
@@ -27,11 +27,11 @@ namespace OCA\EmailRecovery\Notification;

use OCA\EmailRecovery\AppInfo\Application;
use OCA\EmailRecovery\Service\NotificationService;
use OCA\EmailRecovery\Service\RecoveryEmailService;
use OCP\L10N\IFactory;
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
use Psr\Log\LoggerInterface;
use OCA\EmailRecovery\Service\RecoveryEmailService;

class Notifier implements INotifier {
	/** @var IFactory */
+6 −0
Original line number Diff line number Diff line
@@ -86,6 +86,12 @@ class DomainService {
		$this->saveDomainsToFile(self::DISPOSABLE_DOMAINS_FILE, $newDomains);
	}

	/**
	 * Empty custom disposable domains list.
	 */
	public function resetCustomDisposableDomains() : void {
		$this->saveDomainsToFile(self::DISPOSABLE_DOMAINS_FILE, []);
	}
	// -------------------------------
	// Private Helper Methods
	// -------------------------------
Loading