ユーザーのログインと認証に電子メール検証を使用しました。status=1
彼がメールに送信されたリンクをクリックするとステータスが になるようにコードを書きました。そして、ログインページにリダイレクトされます。彼は、登録時に指定したのと同じ詳細でログインする必要があります。メールアドレスとパスワードが一致した場合にユーザーが認証され、ログインするような検証を作成しました。の場合にのみログインしますstatus=1
。このためには、ログイン アクションに変数を追加して、where status=1
. どうすればいいですか?email
以下のコードでは、とのみの検証を取得していpassword
ます。status=1
条件を満足させるには?
これは私のloginActionです
public function loginAction()
{
if(Zend_Auth::getInstance()->hasIdentity())
{
$this->_helper->redirector('register','user','default');
}
$authAdapter = $this->getAuthAdapter();
if(isset($_POST['submit']))
{
$post=$this->_request->getPost();
$email = $post['user_email'];
$password = $post['password'];
$authAdapter->setIdentity($email)
->setCredential($password);
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
if($result->isvalid()){
$identity = $authAdapter->getResultRowObject();
$authStorage = $auth->getStorage();
$authStorage->write($identity);
$this->_helper->redirector('register','user','default');
echo 'valid';
} else {
$this->view->errorMessage = "User name or password is incorrect";
}
}
これは私のステータスアクションです
public function statusAction()
{
$url = explode('&',urldecode($this->_getParam('k')));
$data['email'] = $url[0];
$data['status'] = 1;
$data['access_key'] = $url[1];
$mapper = new Application_Model_UserMapper();
$status = $mapper->update($data);
$this->_helper->redirector('index','projects','default');
}