/** * Create account verification key profile meta. * * @param MembersProfileEvent $event * @param string $guid */ protected function createAccountVerificationKey(MembersProfileEvent $event, $guid) { $metaValue = sha1(Uuid::uuid4()->toString()); // Set the email verification key in the account meta $meta = new Storage\Entity\AccountMeta(); $meta->setGuid($guid); $meta->setMeta(AccountVerification::KEY_NAME); $meta->setValue($metaValue); $this->records->saveAccountMeta($meta); $event->addMetaEntryNames([AccountVerification::KEY_NAME => $metaValue]); }
/** * Generate the HTML for the verification email. * * @param MembersProfileEvent $event * * @return string */ private function getRegisterHtml(MembersProfileEvent $event) { $meta = $event->getMetaEntityNames(); $query = http_build_query(['code' => $meta[AccountVerification::KEY_NAME]]); $context = ['name' => $event->getAccount()->getDisplayname(), 'email' => $event->getAccount()->getEmail(), 'link' => sprintf('%s/%s/profile/verify?%s', $this->siteUrl, $this->config->getUrlMembers(), $query), 'member' => $event->getAccount()]; $mailHtml = $this->twig->render($this->config->getTemplate('verification', 'body'), $context); return $mailHtml; }