public function mfaQuestionValidate($iQuestionId, $iUserId, $answer)
    {
        $oDb = Factory::service('Database');
        $oDb->select('answer, salt');
        $oDb->where('id', $iQuestionId);
        $oDb->where('user_id', $iUserId);
        $oQuestion = $oDb->get(NAILS_DB_PREFIX . 'user_auth_two_factor_question')->row();

        if (!$oQuestion) {
            return false;
        }

        $hash = sha1(sha1(strtolower($answer)) . APP_PRIVATE_KEY . $oQuestion->salt);

        return $hash === $oQuestion->answer;
    }
public function mfaQuestionValidate($iQuestionId, $iUserId, $answer)
    {
        $oDb = Factory::service('Database');
        $oDb->select('answer, salt');
        $oDb->where('id', $iQuestionId);
        $oDb->where('user_id', $iUserId);
        $oQuestion = $oDb->get(NAILS_DB_PREFIX . 'user_auth_two_factor_question')->row();

        if (!$oQuestion) {
            return false;
        }

        $hash = sha1(sha1(strtolower($answer)) . APP_PRIVATE_KEY . $oQuestion->salt);

        return $hash === $oQuestion->answer;
    }
public function mfaQuestionValidate ( $ iQuestionId , $ iUserId , $ answer ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> select ( 'answer, salt' ) ; $ oDb -> where ( 'id' , $ iQuestionId ) ; $ oDb -> where ( 'user_id' , $ iUserId ) ; $ oQuestion = $ oDb -> get ( NAILS_DB_PREFIX . 'user_auth_two_factor_question' ) -> row ( ) ; if ( ! $ oQuestion ) { return false ; } $ hash = sha1 ( sha1 ( strtolower ( $ answer ) ) . APP_PRIVATE_KEY . $ oQuestion -> salt ) ; return $ hash === $ oQuestion -> answer ; }
Validates the answer to an MFA Question

@param  int    $iQuestionId The question's ID
@param  int    $iUserId     The user's ID
@param  string $answer      The user's answer

@return boolean
Validates the answer to an MFA Question