Exemplo n.º 1
0
 public function updatePwd($fromReset = false)
 {
     if ($this->_isAllowed() || $fromReset) {
         $user = $this->getUser();
         try {
             $pwdAux = $this->_user->getPwd();
             if (!empty($pwdAux)) {
                 $nameAux = $this->_user->getName();
                 if (empty($nameAux)) {
                     $userAux = $this->getById($this->_user->getId());
                     $this->_user->setName($userAux->getName());
                 }
                 $this->_user->setSalt(Agana_Util_Crypt::calcRndTimeSalt($this->_user->getPwd(), $this->_user->getName()));
                 $this->_user->setPwd(md5($this->_user->getPwd() . $this->_user->getSalt()));
             }
             $u = new User_Persist_Dao_User();
             return $u->savePwd($this->_user);
         } catch (Exception $e) {
             throw $e;
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Prepare data for update user minus password
  * 
  * @param User_Model_User $user
  * @return Array 
  */
 private function _prepareUpdateData($user)
 {
     $data = array('name' => $user->getName(), 'status' => $user->getStatus(), 'email' => $user->getEmail(), 'acl_role_id' => $user->getAcl_role_id());
     if ($user->getLastLogin() != null && $user->getLastLogin() != '') {
         $data['last_login'] = $user->getLastLogin();
     }
     return $data;
 }