public function recover() { $this->_newPassword = HText::getRandomString(8); $this->_userModel->user_password = $this->_newPassword; //$this->_userModel->hashPassword($this->_newPassword); $this->_userModel->save(); if ($this->hasEvent('onRecover')) { $this->onRecover(new CEvent($this)); } }
protected function beforeValidate() { // генерим другой алиас если текущий дублируется $existAlias = $this->find('alias = :ALIAS', array(':ALIAS' => $this->alias)); if ($existAlias) { $this->alias .= '_' . HText::getRandomString(1); } return true; }