예제 #1
0
 protected function data($data)
 {
     return Data::serialize($data);
 }
예제 #2
0
파일: Auth.php 프로젝트: frnks/meister
 public function forgotPass($_username)
 {
     // Envia email com alguma coisa para ele.
     $fiedlUser = $this->config["auth"]["field"];
     if (empty($fiedlUser)) {
         $fiedlUser = "******";
     }
     $pessoa = $this->db->doc()->getRepository($this->entity)->findOneBy([$fiedlUser => $_username]);
     if (!$pessoa) {
         throw new \Exception(_('meister_auth_pessoa_nao_encontrada'));
     }
     $pessoa = Data::serialize($pessoa);
     $validade = (new \DateTime())->add(new \DateInterval('PT24H'));
     $token = $this->app['hash']->getToken(["id" => $pessoa['id']], "{$_SERVER['REQUEST_SCHEME']}://" . $_SERVER['HTTP_HOST'] . $this->app['WEB_LINK'] . $this->config['auth']['rotarecover'], $validade, true, $pessoa);
     $data = ["url_retorno" => $_SERVER['HTTP_HOST'] . $this->app['WEB_LINK'] . 'hash/' . $token];
     return $this->app['mail']->sendMail($pessoa['email'], 'Token', $this->app['twig']->render('@{module}/Emails/recoverPass.html.twig', $data), true);
 }