ランダムに生成された URL をクリックしたときにユーザーを確認したい。
これら2つのプロセスの解決策を教えてください。
1. URL リクエストからハッシュ (文字列と数値) を取得するための URL マネージャーの構成規則は何ですか?
2.URL のハッシュ値とコントローラー/アクションのデータベースのハッシュ値を比較するにはどうすればよいですか?
電子メールを送信するためのコード (正常に動作しています)
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;
}
コントローラー内のコード
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
}
および現在の URLManager 構成
'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>',
),
),