Example #1
0
 /**
  * Verify action method
  *
  * @param  int    $id
  * @param  string $hash
  * @return void
  */
 public function verify($id, $hash)
 {
     $user = new Model\User();
     $this->prepareView('phire/verify.phtml');
     $this->view->title = 'Verify Your Email';
     $this->view->result = $user->verify($id, $hash);
     $this->view->id = $user->id;
     $this->send();
 }
 /**
  * Verify method
  *
  * @param  string $redirect
  * @return void
  */
 public function verify($redirect = null)
 {
     // If the required user ID and hash is submitted
     if (null !== $this->request->getPath(1) && null !== $this->request->getPath(2)) {
         $this->prepareView('verify.phtml', array('assets' => $this->project->getAssets(), 'acl' => $this->project->getService('acl'), 'phireNav' => $this->project->getService('phireNav'), 'phire' => new Model\Phire(), 'title' => 'Verify'));
         $this->view->set('title', $this->view->i18n->__('Verify'));
         $user = new Model\User();
         $user->getById($this->request->getPath(1));
         // If the user was found, verify and save
         if (isset($user->id) && sha1($user->email) == $this->request->getPath(2)) {
             $user->verify();
             $message = 'Thank you. Your email has been verified.';
             // Else, render failure message
         } else {
             $message = 'Sorry. That email could not be verified.';
         }
         if (null !== $redirect) {
             Response::redirect($redirect);
         } else {
             $this->view->set('message', $this->view->i18n->__($message));
             $this->send();
         }
         // Else, redirect
     } else {
         Response::redirect($this->request->getBasePath());
     }
 }