Esempio n. 1
0
 /**
  * Handles the activation of a new user account
  * 
  * @return void
  */
 public function activateAction()
 {
     $id = $this->getRequest()->getParam('id');
     $url_code = $this->getRequest()->getParam('code');
     $users = new Application_Model_Users();
     if ($user = $users->getUserBy('id', $id)) {
         if (substr(md5($user->register_time . $user->register_ip), 10, 5) === $url_code) {
             $result = $users->activateUser($id, $url_code);
         }
     } else {
         $result = false;
     }
     if (!$result) {
         $this->render('activation-failure');
     } else {
         //log user in
         $auth = Zend_Auth::getInstance();
         $auth->getStorage()->write($user->email);
         $authSess = new Zend_Session_Namespace('Auth');
         $authSess->identity = $user->email;
         $authSess->user = $user->toArray();
         $integrations = new Application_Model_Integrations();
         $integrations->onAuthenticate();
         $this->render('activation-success');
     }
 }
Esempio n. 2
0
 protected function destroySession()
 {
     $integrations = new Application_Model_Integrations();
     $integrations->onDestroySession();
     if (Zend_Session::sessionExists()) {
         Zend_Session::destroy(true, true);
     }
 }