public function isInputtedTwoFactorAuthCodeCorrect($userId=null) {
        $inputted2faCode = $this->request->input('2facode');

        if (isset($userId)) {
            $sent2faCode     = $this->getUserSmsToken($userId);
        } else {
            $sent2faCode     = $this->request->session()->get('codeToInput');
        }


        if ($inputted2faCode == $sent2faCode) {
            return true;
        }

        return false;
    }
public function isInputtedTwoFactorAuthCodeCorrect($userId=null) {
        $inputted2faCode = $this->request->input('2facode');

        if (isset($userId)) {
            $sent2faCode     = $this->getUserSmsToken($userId);
        } else {
            $sent2faCode     = $this->request->session()->get('codeToInput');
        }


        if ($inputted2faCode == $sent2faCode) {
            return true;
        }

        return false;
    }
public function isInputtedTwoFactorAuthCodeCorrect ( $ userId = null ) { $ inputted2faCode = $ this -> request -> input ( '2facode' ) ; if ( isset ( $ userId ) ) { $ sent2faCode = $ this -> getUserSmsToken ( $ userId ) ; } else { $ sent2faCode = $ this -> request -> session ( ) -> get ( 'codeToInput' ) ; } if ( $ inputted2faCode == $ sent2faCode ) { return true ; } return false ; }
Did the user input the correct 2FA code?

@param  int    $userId                      User ID --> if null, then called by 2FA registration;
otherwise, called by 2FA login

@return bool
Did the user input the correct 2FA code?