Skip to content

Commit

Permalink
Added confirmation key to mailing list recipients
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Parker committed Oct 24, 2024
1 parent 01974c9 commit 25a4b61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGEDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -835,4 +835,5 @@
CREATE TABLE `gibbonMessengerMailingList` ( `gibbonMessengerMailingListID` int(8) unsigned NOT NULL AUTO_INCREMENT, `surname` varchar(60) DEFAULT NULL, `preferredName` varchar(60) DEFAULT NULL, `email` varchar(75) NOT NULL, `timestampCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`gibbonMessengerMailingListID`), UNIQUE KEY `email` (`email`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;end
INSERT IGNORE INTO `gibbonAction` (`gibbonModuleID`, `name`, `precedence`, `category`, `description`, `URLList`, `entryURL`, `entrySidebar`, `menuShow`, `defaultPermissionAdmin`, `defaultPermissionTeacher`, `defaultPermissionStudent`, `defaultPermissionParent`, `defaultPermissionSupport`, `categoryPermissionStaff`, `categoryPermissionStudent`, `categoryPermissionParent`, `categoryPermissionOther`) VALUES((SELECT gibbonModuleID FROM gibbonModule WHERE name='Messenger'), 'Manage Mailing List', 0, 'Targets', 'Manage users within the schools\' external mailing list.', 'mailingList_manage.php, mailingList_manage_add.php, mailingList_manage_edit.php, mailingList_manage_delete.php', 'mailingList_manage.php', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', 'N', 'N', 'N');end
INSERT IGNORE INTO `gibbonPermission` (`gibbonRoleID` ,`gibbonActionID`) VALUES ('001', (SELECT gibbonActionID FROM gibbonAction JOIN gibbonModule ON (gibbonAction.gibbonModuleID=gibbonModule.gibbonModuleID) WHERE gibbonModule.name='Messenger' AND gibbonAction.name='Manage Mailing List'));end
ALTER TABLE `gibbonMessengerMailingList` ADD `key` varchar(40) DEFAULT NULL AFTER `email`;end
";
11 changes: 7 additions & 4 deletions modules/Messenger/mailingList_manage_addProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Gibbon\Data\Validator;
use Gibbon\Services\Format;
use Gibbon\Data\PasswordPolicy;
use Gibbon\Domain\Messenger\MailingListGateway;

require_once '../../gibbon.php';
Expand All @@ -36,11 +37,13 @@
} else {
// Proceed!
$mailingListGateway = $container->get(MailingListGateway::class);

$randStrGenerator = new PasswordPolicy(true, true, false, 40);

$data = [
'surname' => $_POST['surname'] ?? '',
'preferredName' => $_POST['preferredName'] ?? '',
'email' => filter_var(trim($_POST['email'] ?? ''), FILTER_SANITIZE_EMAIL),
'surname' => $_POST['surname'] ?? '',
'preferredName' => $_POST['preferredName'] ?? '',
'email' => filter_var(trim($_POST['email'] ?? ''), FILTER_SANITIZE_EMAIL),
'key' => $randStrGenerator->generate()
];

// Validate the required values are present
Expand Down

0 comments on commit 25a4b61

Please sign in to comment.