How To Get Setnewpassword Value Form View Password Reset In Yii

Hi Experts,

I’m trying to reset password. when user clicks the link in his mail. he’ll be redirected to my controller as below…its checking and performing a check but I need to send user to resetpassword page and I need to capture new password so that i can save in my model according to that particular id.

I’m able to send user to resetpassword page but unable to get the resetpassword value and unable to find the record in my table.

http://localhost/webapp/index.php?r=user/resetpassword&verificationcode=475f007030bd74bcdc7c991e0e359a03

Controller:




public function actionResetPassword(){

		

		if(isset($_GET['verificationcode'])){

			$verificationcode = $_GET['verificationcode'];

			$record = User::model()->findByAttributes(array('reset_password' => $verificationcode));

			

			if ($record === null){

				throw new CHttpException('Invalid credentials.');}

			else{

			

			User::model()->updateByPk(

			$record->id,

			array('password'=>$verificationcode));

				echo "your password checked you can use this password or you can reset new password";

				$model=User::model()->findByPk($record->id);

				

				//show the view with the password field

				$this->render('resetpassword',array(

						'model'=>$model,

				));

			//$this->render('setnewpassword'); //show the view with the setnewpassword field

			}

		}

		elseif(isset($_POST['resetpassword']))

		{

			echo "yes";die;

			$password = $_POST['resetpassword'];

			$record = User::model()->findByAttributes(array('reset_password' => $verificationcode));

			echo $password;die;

			 User::model()->updateByPk(

			 		$record->id,

			 		array('password'=>$password));

			// $this->render('index');

			//  echo "done";

			

			

		}



resetpassword view:




 <?php $form=$this->beginWidget('CActiveForm', array(

         'id'=>'password-form',

           'enableClientValidation'=>true,

            ));

 		 //echo CHtml::label('Enter your new password');

 		  

          echo CHtml::textField('resetpassword');

          //echo CHtml::submitButton('Reset My Password');

          echo CHtml::submitButton($model->isNewRecord ? 'resetpassword' : 'Reset My Password');

          $this->endWidget();

any help pls

Many Thanks,

got it :)

sending to my controller with ajax post request like this:




<?php

$form=$this->beginWidget('CActiveForm', array(

		'id'=>'user-form',

		'enableAjaxValidation'=>true,

		'action'=>$this->createUrl('user/resetpassword'),

		'enableClientValidation'=>true,

));


		echo "Enter your news password <br/>";

		echo CHtml::textField('setnewpassword');

		echo CHtml::ajaxSubmitButton('Save',CHtml::normalizeUrl(array('user/resetpassword','render'=>true)),

		array(

				'type'=>'post',

		));

$this->endWidget();

?>

any best way to implent rather using ajax request.??

Thanks