/** * Sends out a confirmation mail to the registered account * * @param Account $account */ private function sendConfirmationMail(Account $account) { $mailText = "Congratulations " . $account->getName() . ", you registered at Eternal Deztiny. To complete your registration, "; $server = 'ed.com'; if (array_key_exists('SERVER_NAME', $_SERVER)) { $server = $_SERVER['SERVER_NAME']; } $mailText .= "follow the link:\n" . $server . "/account/activate/" . $account->getUserHash(); $this->appMailService->sendMail($account->getEmail(), 'Your registration at Eternal Deztiny', $mailText); }
/** * Saves an account to the db. If the id exists the given dataset will be updated * @param \Account\Model\Account $account * * @throws \Exception */ public function saveAccount(Account $account) { $data = ['name' => $account->getName(), 'password' => $account->getPassword(), 'userhash' => $account->getUserHash(), 'email' => $account->getEmail(), 'role' => $account->getRole(), 'avatar' => $account->getAvatar(), 'date_registered' => $account->getDateRegistered(), 'mini' => $account->getMini()]; if (!$account->getId()) { $data['password'] = hash('sha256', $account->getPassword()) . Constants::SALT; $this->tableGateway->insert($data); } else { if ($this->getAccount($account->getId())) { $this->tableGateway->update($data, ['id' => $account->getId()]); } else { throw new \Exception('Account id does not exist'); } } }
/** * Sends out a lost password mail to the given account * @param Account $account */ private function sendLostPasswordMail(Account $account) { $mailText = 'Hello ' . $account->getName() . ', a password reset for your account was requested. ' . 'If you didn\'t request a password reset, you don\'t need to do anything. If you really want to ' . 'reset your password, please follow the given link: ' . $_SERVER['SERVER_NAME'] . '/account/resetpassword/' . $account->getUserHash(); $this->appMailService->sendMail($account->getEmail(), 'Password Reset', $mailText); }