/** * @param array $formData * @return bool */ protected function sendEmailCopy(array $formData) { $systemSettings = $this->getSystemSettings(); $settings = $this->getContactSettings(); $subject = $this->buildSubject('sender_subject', $systemSettings['site_title']); $body = $this->buildEmailBody($formData, 'sender_body'); return $this->sendEmail->execute($formData['name'], $formData['mail'], $settings['mail'], $subject, $body); }
/** * @param array $user * @param string $newPassword * @return bool */ protected function sendPasswordChangeEmail(array $user, $newPassword) { $host = $this->request->getHost(); $systemSettings = $this->config->getSettings(Schema::MODULE_NAME); $subject = $this->translator->t('users', 'forgot_pwd_mail_subject', ['{title}' => $systemSettings['site_title'], '{host}' => $host]); $body = $this->translator->t('users', 'forgot_pwd_mail_message', ['{name}' => $user['nickname'], '{mail}' => $user['mail'], '{password}' => $newPassword, '{title}' => $systemSettings['site_title'], '{host}' => $host]); $settings = $this->config->getSettings(Users\Installer\Schema::MODULE_NAME); return $this->sendEmail->execute(substr($user['realname'], 0, -2), $user['mail'], $settings['mail'], $subject, $body); }
/** * @param array $formData * @param array $settings * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ protected function executePost(array $formData, array $settings) { return $this->actionHelper->handlePostAction(function () use($formData, $settings) { $this->registrationFormValidation->validate($formData); $systemSettings = $this->config->getSettings(Schema::MODULE_NAME); $subject = $this->translator->t('users', 'register_mail_subject', ['{title}' => $systemSettings['site_title'], '{host}' => $this->request->getHost()]); $body = $this->translator->t('users', 'register_mail_message', ['{name}' => $formData['nickname'], '{mail}' => $formData['mail'], '{password}' => $formData['pwd'], '{title}' => $systemSettings['site_title'], '{host}' => $this->request->getHost()]); $mailIsSent = $this->sendEmail->execute('', $formData['mail'], $settings['mail'], $subject, $body); $salt = $this->secureHelper->salt(Users\Model\UserModel::SALT_LENGTH); $insertValues = ['id' => '', 'nickname' => $this->get('core.helpers.secure')->strEncode($formData['nickname']), 'pwd' => $this->secureHelper->generateSaltedPassword($salt, $formData['pwd'], 'sha512'), 'pwd_salt' => $salt, 'mail' => $formData['mail'], 'date_format_long' => $systemSettings['date_format_long'], 'date_format_short' => $systemSettings['date_format_short'], 'time_zone' => $systemSettings['date_time_zone'], 'language' => $systemSettings['lang'], 'registration_date' => $this->date->getCurrentDateTime()]; $lastId = $this->userRepository->insert($insertValues); $bool2 = $this->permissionsHelpers->updateUserRoles([2], $lastId); $this->setTemplate($this->get('core.helpers.alerts')->confirmBox($this->translator->t('users', $mailIsSent === true && $lastId !== false && $bool2 !== false ? 'register_success' : 'register_error'), $this->appPath->getWebRoot())); }, $this->request->getFullPath()); }