/* @var Connection $connection */
$connection =
$this->
get(Connection::
class);
$customer =
$connection->
fetchAssociative($sql,
[$customerId]);
$email =
$customer['email'
];
$customer['attributes'
] =
$connection->
fetchAssociative('SELECT * FROM s_user_attributes WHERE userID = ?',
[$customerId]);
$context['user'
] =
$customer;
// Send mail
$mail =
Shopware()->
TemplateMail()->
createMail('sCONFIRMPASSWORDCHANGE',
$context);
$mail->
addTo($email);
$mail->
send();
$this->
invalidateExistingPasswordLinkHashes($customerId);
// Add the hash to the optin table
$sql = "INSERT INTO `s_core_optin` (`type`, `datum`, `hash`, `data`) VALUES ('swPassword', NOW(), ?, ?)";
$connection->
executeStatement($sql,
[$hash,
$customerId]);
return [];
}