public ActionResult Index(string pin) { var user = SeguridadDelegate.UsuarioTemporal; if ((user.RequiereOtp && !user.OtpActivo) && string.IsNullOrEmpty(pin)) { var model = SeguridadDelegate.GenerarCodigo(user.CodUsuario); SeguridadDelegate.UsuarioTemporal = user; ViewBag.Action = "Index"; return(PartialView("_CrearClaveAut", model)); } if (!string.IsNullOrEmpty(pin)) { var isCorrectPIN = SeguridadDelegate.ValidarPinAutenticacion(user.CodUsuario, pin); if (!isCorrectPIN) { throw new ControllerException(RecMensajes.Msj_PinInvalido); } } var paises = GeneralesDelegate.ConsultarPaises(); ViewBag.ListaPaises = paises; var idiomas = GeneralesDelegate.ConsultarIdiomas(); ViewBag.ListaIdiomas = idiomas; var preguntas = MembresiaDelegate.ObtenerPreguntas(); ViewBag.CollectionPreguntas = preguntas; return(PartialView("_Registro", new ModUsuarioRegistro { ListaPreguntas = new List <ModPreguntaUsuario> { new ModPreguntaUsuario(), new ModPreguntaUsuario(), new ModPreguntaUsuario(), new ModPreguntaUsuario(), new ModPreguntaUsuario() } })); }
public ActionResult ValidarUsuario(ModLogin login) { Session.RemoveAll(); login.CodSesion = SecurityProps.SessionCode; login.DireccionIpv4 = SecurityProps.Ipv4Address; PocInfoSesion user = null; try { user = SeguridadDelegate.ValidarUsuario(login); } catch (CoreException e) { if (login.IsEmbedded) { e.Validation.Errors.ToList().ForEach(err => { ModelState.AddModelError("", err.Message); }); return(RedirectToAction("Index", "Home")); } throw e; } if (user.NotificaVencimiento) { if (user.FecVencePass.HasValue) { var fecVencimiento = user.FecVencePass.Value; var vencimiento = (fecVencimiento - DateTime.Today).TotalDays; if (vencimiento <= 0) { ViewBag.Vencimiento = "VENCIMIENTO"; ViewBag.IsEmbedded = login.IsEmbedded; var model = new ModCambioContrasena { CodUsuario = user.CodUsuario }; if (login.IsEmbedded) { return(View("_LogInRenew", model)); } return(PartialView("_LogInRenew", model)); } if (login.IsEmbedded) { ViewBag.Vencimiento = vencimiento; return(View("_LogInRenewPrompt")); } return(Json(new { vencimiento = vencimiento }, JsonRequestBehavior.AllowGet)); } } if (AppProperties.SECURITY == (int)EnumIdEstado.Activo) { if (user.OtpActivo) { if (login.IsEmbedded) { return(View("_AutenticarOTP")); } return(PartialView("_AutenticarOTP")); } else if (user.IdEstado == (int)EnumEstadoUsuario.Activo && user.RequiereOtp && !user.OtpActivo) { ViewBag.Action = "validaOTP"; var model = SeguridadDelegate.GenerarCodigo(user.CodUsuario); SeguridadDelegate.UsuarioTemporal = user; if (login.IsEmbedded) { return(View("_CrearClaveAut", model)); } return(PartialView("_CrearClaveAut", model)); } } return(ProcesaRespuestaAuth(false, login.IsEmbedded)); }