public function sendResettingEmailMessage(SiteUser $user)
 {
     $template = $this->parameters['resetting.template'];
     $url = $this->router->generate('mailer_resetting_reset', array('token' => $user->getConfirmationToken()), true);
     $rendered = $this->templating->render($template, array('user' => $user, 'confirmationUrl' => $url));
     $this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $user->getEmail());
 }
 public function update(SiteUser $siteUser)
 {
     //update data in chromedia global accounts
     if (!$siteUser->getAccountId()) {
         return null;
     }
     $siteUser = $this->updateUser($siteUser);
     return $siteUser;
 }
 public function update(SiteUser $siteUser)
 {
     if (!$siteUser->getAccountId()) {
         throw InvalidInstitutionUserOperationException::illegalUpdateWithNoAccountId();
     }
     // removed password hashing here to avoid double hashing when a site user will be updated, without updating the password
     //$siteUser->setPassword(SecurityHelper::hash_sha256($siteUser->getPassword()));
     // update user in chromedia global accounts
     $siteUser = $this->updateUser($siteUser);
     $em = $this->doctrine->getEntityManager();
     $em->persist($siteUser);
     $em->flush();
     return $siteUser;
 }
 /**
  * Find an account in global chromedia by accountId
  *
  * @param \HealthCareAbroad\UserBundle\Entity\SiteUser $user
  * @return SiteUser
  */
 public function getUser(\HealthCareAbroad\UserBundle\Entity\SiteUser $user)
 {
     if ($user->getAccountId()) {
         $response = $this->request->get($this->chromediaAccountsUri . '/' . $user->getAccountId());
         if (200 == $response->getStatusCode()) {
             $accountData = \json_decode($response->getBody(true), true);
             return $this->hydrateAccountData($user, $accountData);
         } else {
             throw new FailedAccountRequestException($response->getBody(true));
         }
     } else {
         throw new FailedAccountRequestException("Cannot get Account with no id");
     }
 }