yii で、パスワードを忘れる機能を作成しています。このユーザーは、電子メール ID を入力します。この電子メール ID が正しい場合、データベースから securityQuestion ID を取得し、その質問をユーザーに表示します。答えが正しい場合、パスワード リセット リンクが送信されます。ユーザーの電子メールIDに。コントローラーで私は次のように行動しました
public function ActionForget{if(isset($_POST['email']))
{ $record=User::model()->find(array(
'select'=>'primaryEmail',
'condition'=>'PrimaryEmail=:email',
'params'=>array(':email'=>$_POST['email']))
); if($record===null) {
$error = 'Email invalid';
} else {
$mailer = Yii::createComponent('application.extensions.mailer.EMailer');
$mailer->IsSMTP();
$mailer->IsHTML(true);
$mailer->SMTPAuth = true;
$mailer->SMTPSecure = "ssl";
$mailer->Host = "smtp.gmail.com";
$mailer->Port = 465;
$mailer->CharSet = 'UTF-8';
$mailer->Username = "abc@shailani.com";
$mailer->Password = "abc";
$mailer->From = "xyz@shailani.com";
$mailer->FromName = "Balaee.com";
$mailer->AddAddress($record);
$mailer->Subject = "welcome to Balaee";
$mailer->IsHTML(true);
$mailer->Body = "<h1>Thanks to showing interest </h1><br>click on link for other detail ".$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if($mailer->Send()) {echo "Please check mail";}
else {echo "Fail to send your message!"; }}}
else{ $this->render('emailForm'); //show the view with the password field}}
プライマリメールIDと送信ボタンを入力するためのビューファイルとしてpassword.phpを持っています
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'email-form',
'enableClientValidation'=>true,
));
echo CHtml::textField('email');
echo CHtml::submitButton('Send');
$this->endWidget();
ただし、ユーザーがプライマリ電子メール ID を送信した後、アクションは実行されません。だから誰か私がする必要がある変更を教えてください