Ejemplo n.º 1
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->user_id = Yii::app()->user->id;
     }
     return parent::beforeSave();
 }
Ejemplo n.º 2
0
 public function beforeSave()
 {
     if (in_array($this->scenario, array(Customer::SCENARIO_INSERT, Customer::SCENARIO_UPDATEPASSWORD, Customer::SCENARIO_RESETPASSWORD)) && $this->record_type == Customer::REGISTERED && $this->password) {
         $hashCostParam = _xls_get_conf('PASSWORD_HASH_COST_PARAM');
         if ($hashCostParam) {
             $this->password = CPasswordHelper::hashPassword($this->password, $hashCostParam);
         } else {
             $this->password = CPasswordHelper::hashPassword($this->password);
         }
     }
     // If token is set it means a temp_password has just been created,
     // in all other situations erase the temp_password on save
     if (!$this->token) {
         $this->temp_password = null;
     }
     return parent::beforeSave();
 }