Actualizacion

parent 949d0d0d
......@@ -104,9 +104,15 @@ class DefaultController extends Controller {
$ua = $request->headers->get('User-Agent');
$ip = $request->getClientIp();
$log->debug("Ingresando al landing de Nutrapharm... IP : $ip | UA : $ua....");
$nombre = $request->get("nombreUsuario", null);
$correo = $request->get("mailUsuario", null);
if($tipo == UsuarioNutrapharm::ESTADO_FOTO_INICIAL || $tipo == UsuarioNutrapharm::ESTADO_FOTO_ACTUALIZADA){
$nombre = $request->get("nombreUsuario", null);
$correo = $request->get("mailUsuario", null);
}else{
$nombre = "Dummy";
$correo = "no@mail.cl";
}
$comentario = $request->get("comentarioFotoUsuario", null);
$idUsuarioNutraPharm = $request->get("usuarioNutraPharm", null);
$tipo = $request->get("tipoUsuarioFormulario", null);
......@@ -116,9 +122,24 @@ class DefaultController extends Controller {
//VERIFICAR DATOS DE ENTRADA
/* Verificacion Mail */
if (!Utiles::validarCorreo($correo) || UsuarioNutrapharmQuery::correoRegistrado($correo) >= 1 && $tipo != UsuarioNutrapharm::ESTADO_FOTO_ACTUALIZADA) {
if($tipo == UsuarioNutrapharm::ESTADO_FOTO_INICIAL){
if(UsuarioNutrapharmQuery::correoRegistrado($correo)){
$log->debug("El correo $correo ingresado ya se encuentra registrado en el sistema...");
return new JsonResponse(array("msg" => "El correo ingresado ya se ha registrado en el sistema!"), Response::HTTP_BAD_REQUEST, ['content-type' => 'application/json']);
}
}else if($tipo == UsuarioNutrapharm::ESTADO_FOTO_ACTUALIZADA){
$usuario = UsuarioNutrapharmQuery::create()->filterByUnuIdNutrapharm($idUsuarioNutraPharm)->findOne() ;
$correoActual = $usuario->getUnuCorreo();
if($correoActual != $correo && UsuarioNutrapharmQuery::correoRegistrado($correo)){
$log->debug("El correo $correo ingresado ya se encuentra registrado en el sistema...");
return new JsonResponse(array("msg" => "El correo ingresado ya se ha registrado en el sistema!"), Response::HTTP_BAD_REQUEST, ['content-type' => 'application/json']);
}
}
if (!Utiles::validarCorreo($correo)) {
$log->debug("El correo no es válido o no posee un formato correcto...");
return new JsonResponse(array("msg" => "El correo ingresado no es válido o ya se ha registrado en el sistema!"), Response::HTTP_BAD_REQUEST, ['content-type' => 'application/json']);
return new JsonResponse(array("msg" => "El correo ingresado no es válido!"), Response::HTTP_BAD_REQUEST, ['content-type' => 'application/json']);
}
/* Vrificacion String Nombre */
......@@ -133,7 +154,6 @@ class DefaultController extends Controller {
return new JsonResponse(array("msg" => "El comentario ingresado no es válido!"), Response::HTTP_BAD_REQUEST, ['content-type' => 'application/json']);
}
//TODO
if ($uploadFile == 1) {//foto subida
$log->debug("Creando variable de archivo...");
$file = $request->files->get('imagen');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment