Esempio n. 1
0
 /**
  * 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');
         }
     }
 }
Esempio n. 2
0
 /**
  * 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);
 }
 private function sendAssignmentMail(Account $account, array $assignments, string $strategy)
 {
     $target_main = implode(',', array_keys($assignments, strtolower($account->getName())));
     $target_mini = implode(',', array_keys($assignments, strtolower($account->getMini())));
     $text = 'Hello ' . $account->getName() . ". Your targets are:\n";
     if ($target_main) {
         $text .= $account->getName() . ': ' . $target_main . "\n";
     }
     if ($target_mini) {
         $text .= $account->getMini() . ': ' . $target_mini . "\n";
     }
     $text .= 'War Strategy: ' . $strategy . "\n\n";
     $text .= 'Good Luck. Further information can be found under ' . $_SERVER['SERVER_NAME'] . '/warclaim/';
     $this->appMailService->sendMail($account->getEmail(), 'A new war has started!', $text);
 }
 /**
  * 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);
 }