예제 #1
0
 /**
  * @param Request $request
  *
  * @return bool
  */
 protected function _validateCaptcha($request)
 {
     //  If captcha is on, check it...
     if (config('dashboard.require-captcha') && $request->isMethod(Request::METHOD_POST)) {
         $_validator = \Validator::make(\Input::all(), ['g-recaptcha-response' => 'required|recaptcha']);
         if (!$_validator->passes()) {
             \Log::error('recaptcha failure: ' . print_r($_validator->errors()->all(), true));
             Flasher::set('There was a problem with your request.', false);
             return false;
         }
     }
     return true;
 }
예제 #2
0
 /**
  * @param string $url
  * @param array  $payload
  * @param bool   $returnAll
  *
  * @param string $method
  *
  * @return bool|mixed|\stdClass
  */
 protected function callConsole($url, $payload = [], $returnAll = true, $method = Request::METHOD_POST)
 {
     /** @type OpsClientService $_service */
     $_service = app(OpsClientServiceProvider::IOC_NAME);
     $_response = $_service->guzzleAny($url, $payload, [], $method);
     if ($_response && is_object($_response) && isset($_response->success)) {
         return $returnAll ? $_response : $_response->response;
     }
     //	Error and redirect
     Flasher::set('An unexpected situation has occurred with your request. Please try again in a few minutes, or email <a href="mailto:support@dreamfactory.com">support@dreamfactory.com</a>.', false);
     if (is_string($_response)) {
         $this->error('Console API call received unexpected result: ' . $_response);
     }
     return false;
 }