public function activateAction()
 {
     SxCms_Acl::requireAcl('account', 'account.activate');
     $id = $this->_getParam('id');
     $proxy = new SxCms_User_DataMapper();
     $user = $proxy->getById($id);
     $user->activate();
     $this->_helper->redirector->gotoSimple('index', 'account');
 }
Esempio n. 2
0
 public function getuser($user_id = 0)
 {
     $proxy = new SxCms_User_DataMapper();
     $user = $proxy->getById($user_id);
     return $user->getFullName();
 }
Esempio n. 3
0
 /**
  * Login the user and create an identity
  * 
  * @return bool
  */
 public function login()
 {
     $dbAdapter = Zend_Registry::get('db');
     $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
     $authAdapter->setTableName('User')->setIdentityColumn('email')->setCredentialColumn('password')->setCredentialTreatment('SHA1(?)');
     $authAdapter->setIdentity($this->getEmail())->setCredential($this->password);
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($authAdapter);
     if (!$result->isValid()) {
         return false;
     }
     $user = $authAdapter->getResultRowObject(null, 'password');
     if ($user && !$user->active) {
         $msg = Sanmax_MessageStack::getInstance('SxCms_User');
         $msg->addMessage('email', array("email" => "Gebruiker is niet actief"));
         $auth->clearIdentity();
         return false;
     }
     $mapper = new SxCms_User_DataMapper();
     $user = $mapper->getById($user->user_id);
     $storage = $auth->getStorage();
     $storage->write($user);
     return true;
 }