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;
         }
     }
 }