17cac351efdeaa298425cb627e20cde582eacb73
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 namespace wcf\system\event\listener;
4
5 use wcf\system\email\SimpleEmail;
6 use wcf\system\user\authentication\UserMultifactorSucceeded;
7
8 /**
9 * Sends a notification email when the user performs MF authentication.
10 *
11 * @author Tim Duesterhus
12 * @copyright 2001-2021 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @package WoltLabSuite\Core\System\Event\Listener
15 */
16 final class UserMultifactorSucceededEmailNotificationListener implements IParameterizedEventListener
17 {
18 /**
19 * @inheritDoc
20 * @param UserMultifactorSucceeded $eventObj
21 */
22 public function execute($eventObj, $className, $eventName, array &$parameters)
23 {
24 $email = new SimpleEmail();
25 $email->setRecipient($eventObj->getUser());
26 $email->setSubject("You performed MFA with {$eventObj->getSetup()->getObjectType()->objectType}");
27 $email->setMessage("You performed MFA with {$eventObj->getSetup()->getObjectType()->objectType}");
28 $email->setHtmlMessage("You performed MFA with {$eventObj->getSetup()->getObjectType()->objectType}");
29 $email->send();
30 }
31 }