I want to verify the user when he click the random generated URL.
Give me solution for these two process.
1.What is the URL manager configuration rules for get the hash (string and numbers) from url request?
2.How can I compare the hash value in URL with my hash value in database on Controller/Action?
Code for sending email (it's working fine)
protected function afterSave()
{
$activation_url = Yii::app()->createAbsoluteUrl('SignUp/Activate',array('activate_link'=>$this->activate_link));
Yii::import('ext.yii-mail.YiiMailMessage');
$message = new YiiMailMessage;
$message->setBody($activation_url);
$message->subject = 'Hello hell';
$message->addTo($this->email);
$message->from = Yii::app()->params['adminEmail'];
Yii::app()->mail->send($message);
return true;
}
Code in Controller
public function actionActivate($activation) {
$model= Signup::model()->findByAttributes(array(
'activate_link' => $activation
));
if ($model === null)
$this->redirect('index.php');
else
$model->user_status = 1;
$model->save();
$this->redirect('index.php');
//redirect / flash / login whatever
}
and current URLManager configuration
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
),
Make change in your Url manager as shown
And the sample confirm action Send the email in the format of get parameters with the key in the url and get that key in action as i have done in passkey