public function verify(Request $request)
    {
        if (!config('laravel2step.laravel2stepEnabled')) {
            abort(404);
        }

        if ($request->ajax()) {
            $validator = Validator::make($request->all(), [
                'v_input_1' => 'required|min:1|max:1',
                'v_input_2' => 'required|min:1|max:1',
                'v_input_3' => 'required|min:1|max:1',
                'v_input_4' => 'required|min:1|max:1',
            ]);

            if ($validator->fails()) {
                $returnData = $this->invalidCodeReturnData($validator->errors());

                return response()->json($returnData, 418);
            }

            $code = $request->v_input_1.$request->v_input_2.$request->v_input_3.$request->v_input_4;
            $validCode = $this->_twoStepAuth->authCode;

            if ($validCode != $code) {
                $returnData = $this->invalidCodeReturnData();

                return response()->json($returnData, 418);
            }

            $this->resetActivationCountdown($this->_twoStepAuth);

            $returnData = [
                'nextUri' => session('nextUri', '/'),
                'message' => trans('laravel2step::laravel-verification.titlePassed'),
            ];

            return response()->json($returnData, 200);
        } else {
            abort(404);
        }
    }
public function verify(Request $request)
    {
        if (!config('laravel2step.laravel2stepEnabled')) {
            abort(404);
        }

        if ($request->ajax()) {
            $validator = Validator::make($request->all(), [
                'v_input_1' => 'required|min:1|max:1',
                'v_input_2' => 'required|min:1|max:1',
                'v_input_3' => 'required|min:1|max:1',
                'v_input_4' => 'required|min:1|max:1',
            ]);

            if ($validator->fails()) {
                $returnData = $this->invalidCodeReturnData($validator->errors());

                return response()->json($returnData, 418);
            }

            $code = $request->v_input_1.$request->v_input_2.$request->v_input_3.$request->v_input_4;
            $validCode = $this->_twoStepAuth->authCode;

            if ($validCode != $code) {
                $returnData = $this->invalidCodeReturnData();

                return response()->json($returnData, 418);
            }

            $this->resetActivationCountdown($this->_twoStepAuth);

            $returnData = [
                'nextUri' => session('nextUri', '/'),
                'message' => trans('laravel2step::laravel-verification.titlePassed'),
            ];

            return response()->json($returnData, 200);
        } else {
            abort(404);
        }
    }
public function verify ( Request $ request ) { if ( ! config ( 'laravel2step.laravel2stepEnabled' ) ) { abort ( 404 ) ; } if ( $ request -> ajax ( ) ) { $ validator = Validator :: make ( $ request -> all ( ) , [ 'v_input_1' => 'required|min:1|max:1' , 'v_input_2' => 'required|min:1|max:1' , 'v_input_3' => 'required|min:1|max:1' , 'v_input_4' => 'required|min:1|max:1' , ] ) ; if ( $ validator -> fails ( ) ) { $ returnData = $ this -> invalidCodeReturnData ( $ validator -> errors ( ) ) ; return response ( ) -> json ( $ returnData , 418 ) ; } $ code = $ request -> v_input_1 . $ request -> v_input_2 . $ request -> v_input_3 . $ request -> v_input_4 ; $ validCode = $ this -> _twoStepAuth -> authCode ; if ( $ validCode != $ code ) { $ returnData = $ this -> invalidCodeReturnData ( ) ; return response ( ) -> json ( $ returnData , 418 ) ; } $ this -> resetActivationCountdown ( $ this -> _twoStepAuth ) ; $ returnData = [ 'nextUri' => session ( 'nextUri' , '/' ) , 'message' => trans ( 'laravel2step::laravel-verification.titlePassed' ) , ] ; return response ( ) -> json ( $ returnData , 200 ) ; } else { abort ( 404 ) ; } }
Verify the user code input.

@param Request $request

@return \Illuminate\Http\Response
Verify the user code input .