Hi there,
I’m making a password recovery system and I’m a little stuck as to how to proceed.
I’m going to do the usual of creating a validation code that gets emailed etc etc.
My problem is how to create the password recovery form (where they enter the email)?
Should I use a model?
I want to take advantage of Yii’s validation rules so I was thinking of creating an action In UserController, something like:
public function actionForgotPassword()
{
$model = new User;
$model->scenario = 'forgotPassword';
if(isset($_POST['User']))
{
$model->attributes=$_POST['User'];
//send email, do other stuff here
}
$this->render('forgotPassword',array(
'model'=>$model,
));
}
Is this a viable way of doing this?
It somehow seems wrong that I’m creating a new User model instance.
Thanks in advance.