public function actionChangePassword() { $transaction = Yii::app()->db->beginTransaction(); try { $model = new ChangePassword(); if (isset($_POST['ChangePassword'])) { $model->attributes = $_POST['ChangePassword']; if ($model->save()) { $this->audit->logAudit(Yii::app()->user->id, new DateTime(), AppConstants::AUDIT_OBJECT_USER, AppConstants::AUDIT_OPERATION_CHANGE_PASSWORD, Yii::app()->user->id); $this->render('/site/successfullOperation', array('header' => 'Contraseña modificada con éxito', 'message' => 'Haga click en volver para regresar a Mi Perfil', 'returnUrl' => Yii::app()->createUrl('user/myProfile'))); $transaction->commit(); return; } else { $transaction->rollback(); } } $this->render('changePassword', array('model' => $model)); } catch (Exception $exc) { Yii::log($exc->getMessage(), DBLog::LOG_LEVEL_ERROR); $transaction->rollback(); } }
public function actionChangePassword() { // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $model = new ChangePassword(); if (isset($_POST['ChangePassword'])) { $model->attributes = $_POST['ChangePassword']; if ($model->save()) { $this->audit->logAudit(Yii::app()->user->id, new DateTime(), Constants::AUDITORIA_OBJETO_USUARIO, Constants::AUDITORIA_OPERACION_CAMBIAR_CONTRASENIA, Yii::app()->user->id); $this->render('/site/successfullOperation', array('header' => 'Contraseña modificada con éxito', 'message' => 'Haga click en volver para regresar a Mi Perfil', 'returnUrl' => Yii::app()->createUrl('user/miPerfil'))); return; } } $this->render('changePassword', array('model' => $model)); }