<?php
/**
 * @copyright ONE/DEPO Project
 * @license   PHP License 3.01 <http://www.php.net/license/3_01.txt>
 */


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * [[機能説明]]
 *
 * @package     [[package名]]
 * @author      H.Watanabe <hiroshi.watanabe@netnee.jp>
 * @access      public
 */
class Customer_Mypage_Member_Forget_Password_Form_Pass
{
    /**
     * [[機能説明]]
     *
     * @access  public
     */
    
    // component
    var $c_member;
    var $c_secquestion;
    var $l_crypt;
    var $actionChain;
    
    var $mailaddr;
    var $question;
    var $answer;

    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Customer_Mypage_Member_Forget_Password_Form_Passが実行されました", "Customer_Mypage_Member_Forget_Password_Form_Pass#execute");
        
        $errorList =& $this->actionChain->getCurErrorList();
        
        // メールアドレスからユーザ情報取得
        $userinfo = $this->c_member->getUserinfoOfMail($this->mailaddr);
        
        if ( !ereg($this->question, $userinfo['secquestioncd']) ) {
            $errorList -> add(1, "秘密の質問が違います。");
            
            // 秘密の質問取得
            $this->secquestion = $this->c_secquestion->selectAll();
            return 'input';
        }
        
        //質問の答えデコード
        $decode_answer = $this -> l_crypt -> decrypt($userinfo['secquestionans']);
        
        if( !ereg($decode_answer, $this->answer) ) {
            $errorList -> add(1, "秘密の質問が違います。");
            
            // 秘密の質問取得
            $this->secquestion = $this->c_secquestion->selectAll();
            return 'input';
        }
        
        return 'success';
    }
}
?>
