Registros antispam
Showing
... | @@ -23,7 +23,7 @@ class CrmFormsController extends Controller | ... | @@ -23,7 +23,7 @@ class CrmFormsController extends Controller |
public function store(RequestInterested $request) | public function store(RequestInterested $request) | ||
{ | { | ||
$request; | error_log("$request"); | ||
$agent = new Agent(); | $agent = new Agent(); | ||
$agent->setUserAgent($request->header('User-Agent')); | $agent->setUserAgent($request->header('User-Agent')); | ||
$browser = $agent->browser(); | $browser = $agent->browser(); | ||
... | @@ -46,75 +46,65 @@ class CrmFormsController extends Controller | ... | @@ -46,75 +46,65 @@ class CrmFormsController extends Controller |
$agent->isTablet(); | $agent->isTablet(); | ||
$user = User::find(1); | $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){ | |||
$url = "https://apps.emaillistverify.com/api/verifyEmail?secret=".env('KEY_VERIFY')."&email=".$request->email; | 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(); | |||
$client = new \GuzzleHttp\Client(); | if ( $respuesta == 'ok') { //Si el correo es valido | ||
$res = $client->request('GET', $url); | $interested = Interested::create($request->all()); | ||
$respuesta = $res->getBody(); | $interested->notify(new WelcomeInterested()); | ||
$user->notify(new NewInterestd($interested)); | |||
if ( $respuesta == 'ok') { //Si el correo es valido | $interested_details = InterestedDetail::firstOrNew(['interested_id' => $interested->id]); | ||
$interested_details->browser = $browser; | |||
$interested_details->browser_version = $browser_version; | |||
$interested_details->devise = $devise; | |||
$interested_details->platform = $platform; | |||
$interested_details->platform_version = $platform_version; | |||
$interested_details->session_time = $session_time; | |||
$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 = Interested::create($request->all()); | ||
$interested->notify(new WelcomeInterested()); | $interested->notify(new WelcomeInterested()); | ||
$user->notify(new NewInterestd($interested)); | $user->notify(new NewInterestd($interested)); | ||
$interested_details = InterestedDetail::firstOrNew(['interested_id' => $interested->id]); | $interested_details = InterestedDetail::firstOrNew(['interested_id' => $interested->id]); | ||
$interested_details->browser = $browser; | $interested_details->browser = $browser; | ||
$interested_details->browser_version = $browser_version; | $interested_details->browser_version = $browser_version; | ||
$interested_details->devise = $devise; | $interested_details->devise = $devise; | ||
$interested_details->platform = $platform; | $interested_details->plataform = $platform; | ||
$interested_details->platform_version = $platform_version; | $interested_details->plataform_version = $platform_version; | ||
$interested_details->session_time = $session_time; | $interested_details->session_time = $session_time; | ||
$interested_details->devise_type = $devise_type; | $interested_details->devise_type = $devise_type; | ||
$interested_details->save(); | $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)); | |||
$interested_details = InterestedDetail::firstOrNew(['interested_id' => $interested->id]); | |||
$interested_details->browser = $browser; | return redirect() | ||
$interested_details->browser_version = $browser_version; | |||
$interested_details->devise = $devise; | |||
$interested_details->plataform = $platform; | |||
$interested_details->plataform_version = $platform_version; | |||
$interested_details->session_time = $session_time; | |||
$interested_details->devise_type = $devise_type; | |||
$interested_details->save(); | |||
} | |||
return redirect() | |||
->route('crmforms.redirect', $request->landing) | ->route('crmforms.redirect', $request->landing) | ||
->with('registrado', 'registrado') | ->with('registrado', 'registrado') | ||
->with('message_success', 'Hemos recibido tu solicitud, en breve nos comunicaremos contigo'); | ->with('message_success', 'Hemos recibido tu solicitud, en breve nos comunicaremos contigo'); | ||
}else{ | |||
return redirect()->back(); | |||
} | |||
} | } | ||
public function redirect($landing) | public function redirect($landing) | ||
... | ... |
Please
register
or
sign in
to comment