commit - 10d03f4b458339910f7199b6df2a16e5f42a5732
commit + 5aa69adf3856792313061ad34bd0b5e53f2c2d40
blob - f262f562fe3de434b63a12fa39fccbc4a5d9c19e
blob + 8a9f5248e0a114e6eb764d6df993b180c855b7aa
--- module/Securitx/src/Controller/SecuritxController.php
+++ module/Securitx/src/Controller/SecuritxController.php
use Securitx\Model\DownloadsTable;
use Securitx\Model\Downloads;
use Securitx\Model\Emailer;
+use Securitx\Model\BlockedDomainsTable;
+use Securitx\Model\BlockedDomains;
use Securitx\Form\MemberForm;
use Securitx\Form\UploaderForm;
public function __construct(MemberTable $member_table,
CompanyTable $company_table, DownloadsTable $downloads_table,
- $email_host, $recaptcha, $hipaa) {
+ BlockedDomainsTable $blockeddomains_table, $email_host, $recaptcha,
+ $hipaa) {
$this->member_table = $member_table;
$this->company_table = $company_table;
$this->downloads_table = $downloads_table;
+ $this->blockeddomains_table = $blockeddomains_table;
$this->email_host = $email_host;
$this->file = realpath(getcwd()) . "/data/securitx.db";
$this->recaptcha = $recaptcha;
downloaded INTEGER NOT NULL
)
', Adapter::QUERY_MODE_EXECUTE);
+ $adapter->query('
+ CREATE TABLE blockeddomains (
+ domain_id INTEGER PRIMARY KEY AUTOINCREMENT,
+ domain TEXT NOT NULL
+ )
+ ', Adapter::QUERY_MODE_EXECUTE);
+ $adapter->query('
+ INSERT INTO blockeddomains
+ ("domain")
+ values ("mailinator.com")
+ ', Adapter::QUERY_MODE_EXECUTE);
+ $adapter->query('
+ INSERT INTO blockeddomains
+ ("domain")
+ values ("sharklazers.com")
+ ', Adapter::QUERY_MODE_EXECUTE);
}
/* setup initial company */
$co_added = 0;
]);
}
+ $domains = new BlockedDomains();
+ $domains = $this->blockeddomains_table->fetchAll();
+ $parts = explode('@', $member->email);
+ foreach($domains as $domain) {
+ if ($domain->domain == $parts[1]) {
+ return new ViewModel([
+ 'exists' => false,
+ 'form' => $form,
+ 'companies' => $companies,
+ 'registered' => false,
+ 'valid' => 'Email addresses from this domain are prohibited',
+ ]);
+ }
+ }
+ return new ViewModel([
+ 'exists' => true,
+ 'form' => $form,
+ 'companies' => $companies,
+ 'registered' => false,
+ 'valid' => 'Email addresses from this domain are prohibited',
+ ]);
$validator = new EmailAddress([
'allow' => Hostname::ALLOW_DNS,
'useMxCheck' => true,
blob - /dev/null
blob + cb79013752b1b39fee14962a014b278a31dc1f6f (mode 644)
--- /dev/null
+++ module/Securitx/src/Model/BlockedDomains.php
+<?php
+namespace Securitx\Model;
+
+use DomainException;
+
+class BlockedDomains {
+ public $domain_id;
+ public $domain;
+
+ public function exchangeArray(array $data) {
+ $this->domain_id = !empty($data['domain_id']) ? $data['domain_id'] : null;
+ $this->domain = !empty($data['domain']) ? $data['domain'] : null;
+ }
+}
blob - /dev/null
blob + a83a9c1f043ec3a668abafded708752203dd698e (mode 644)
--- /dev/null
+++ module/Securitx/src/Model/BlockedDomainsTable.php
+<?php
+namespace Securitx\Model;
+
+use RuntimeException;
+use Laminas\Db\TableGateway\TableGatewayInterface;
+
+class BlockedDomainsTable {
+ private $tableGateway;
+
+ public function __construct(TableGatewayInterface $tableGateway) {
+ $this->tableGateway = $tableGateway;
+ }
+ public function fetchAll() {
+ return $this->tableGateway->select();
+ }
+ public function saveDomain(BlockedDomains $domain) {
+ $data = [
+ 'domain' => $download->domain,
+ ];
+
+ $this->tableGateway->insert($data);
+ return;
+ }
+}
blob - 80c1c7b3b4b3a046e6311a8cf2b12b86f6ab7805
blob + 73fb674cf24ebb7884c4a88080bd2b365785cdd2
--- module/Securitx/src/Module.php
+++ module/Securitx/src/Module.php
$resultSetPrototype->setArrayObjectPrototype(new Model\Downloads());
return new TableGateway('downloads', $dbAdapter, null, $resultSetPrototype);
},
+ Model\BlockedDomainsTable::class => function($container) {
+ $tableGateway = $container->get(Model\BlockedDomainsTableGateway::class);
+ return new Model\BlockedDomainsTable($tableGateway);
+ },
+ Model\BlockedDomainsTableGateway::class => function ($container) {
+ $dbAdapter = $container->get(AdapterInterface::class);
+ $resultSetPrototype = new ResultSet();
+ $resultSetPrototype->setArrayObjectPrototype(new Model\BlockedDomains());
+ return new TableGateway('blockeddomains', $dbAdapter, null, $resultSetPrototype);
+ },
],
];
}
$container->get(Model\MemberTable::class),
$container->get(Model\CompanyTable::class),
$container->get(Model\DownloadsTable::class),
+ $container->get(Model\BlockedDomainsTable::class),
$container->get('config')['email_host'],
$container->get('config')['recaptcha'],
$container->get('config')['hipaa'],