Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function actionChangePassword()
- {
- $model=$this->loadModel();
- $params=array('userid' => $model->id);
- if(isset($_POST['User']))
- {
- $model->attributes=$_POST['User'];
- if($model->save())
- $this->redirect(array('index'));
- }
- $model->password=NULL;
- $model->passwordRepeat=NULL;
- /*$params = User::model()->findByPk(Yii::app()->user->id);*/
- if(Yii::app()->user->checkAccess('Profile.ChangePassword',array('userid'=>$params)))
- {
- }
- $this->render('_form',array('model'=>$model));
- }
- /**
- * Returns the data model based on the primary key given in the GET variable.
- * If the data model is not found, an HTTP exception will be raised.
- * @param integer the ID of the model to be loaded
- */
- private function loadModel()
- {
- if(isset($_GET['id']))
- $id = $_GET['id'];
- else
- $id = Yii::app()->user->id;
- $model=User::model()->findByPk($id);
- if($model===null)
- throw new CHttpException(404,'The requested page does not exist.');
- return $model;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement