Registros antispam
Showing
... | ... | @@ -23,7 +23,7 @@ class CrmFormsController extends Controller |
public function store(RequestInterested $request) | ||
{ | ||
$request; | ||
error_log("$request"); | ||
$agent = new Agent(); | ||
$agent->setUserAgent($request->header('User-Agent')); | ||
$browser = $agent->browser(); | ||
... | ... | @@ -46,17 +46,16 @@ class CrmFormsController extends Controller |
$agent->isTablet(); | ||
$user = User::find(1); | ||
if (config('crmforms.validate_email')) { //Se activa la opcion de validar emails por API | ||
if($request->desc2 == "" && $request->email2 == "[email protected]" && strpos($request->email, "@mail.ru") === false){ | ||
if (config('crmforms.validate_email')) { //Se activa la opcion de validar emails por API | ||
$url = "https://apps.emaillistverify.com/api/verifyEmail?secret=".env('KEY_VERIFY')."&email=".$request->email; | ||
$client = new \GuzzleHttp\Client(); | ||
$res = $client->request('GET', $url); | ||
$respuesta = $res->getBody(); | ||
if ( $respuesta == 'ok') { //Si el correo es valido | ||
$interested = Interested::create($request->all()); | ||
$interested->notify(new WelcomeInterested()); | ||
$user->notify(new NewInterestd($interested)); | ||
... | ... | @@ -72,24 +71,16 @@ class CrmFormsController extends Controller |
$interested_details->devise_type = $devise_type; | ||
$interested_details->save(); | ||
} else { // Si el correo no es valido | ||
$user->notify(new EmailInvalid($request->all())); | ||
return redirect() | ||
->back() | ||
->withInput() | ||
->with('fail', 'fail'); | ||
} | ||
} else { // No se valida el correo por api, va directo a la bd | ||
$interested = Interested::create($request->all()); | ||
$interested->notify(new WelcomeInterested()); | ||
$user->notify(new NewInterestd($interested)); | ||
... | ... | @@ -104,17 +95,16 @@ class CrmFormsController extends Controller |
$interested_details->devise_type = $devise_type; | ||
$interested_details->save(); | ||
} | ||
return redirect() | ||
->route('crmforms.redirect', $request->landing) | ||
->with('registrado', 'registrado') | ||
->with('message_success', 'Hemos recibido tu solicitud, en breve nos comunicaremos contigo'); | ||
}else{ | ||
return redirect()->back(); | ||
} | ||
} | ||
public function redirect($landing) | ||
... | ... |
Please
register
or
sign in
to comment