Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MasterPage = (MP_Login)Page.Master;
            if (!IsPostBack)
            {
                // Reset Cookie Inicio
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "setCookieInicio", "setCookie('tab', 'inicio');", true);

                if (Request.QueryString["c"] != null)
                {
                    String codigoConfirmacion = Request.QueryString["c"].ToString();
                    if (RegistroService.ConfirmarCandidato(codigoConfirmacion))
                    {
                        MasterPage.ShowMessage("Aviso", "Su cuenta ha quedado confirmada.");
                    }
                    else
                    {
                        MasterPage.ShowMessage("Error", "Código de confirmación inválido.");
                    }
                }
            }
            else
            {
                // Set Selected tab
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "setSelectedTab", "autoChangeTab();", true);
            }
        }
Example #2
0
        protected void Registra_Juez(object sender, EventArgs e)
        {
            // Correo de la persona que invitare
            String correoInvitar = correoJuez.Text;

            Regex regexCorreo = new Regex(@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$");

            Match matchCorreo = regexCorreo.Match(correoInvitar);

            if (!matchCorreo.Success)
            {
                MasterPage.ShowMessage("Error", "Dirección de correo no válida.");
                return;
            }

            string contrasena = System.Web.Security.Membership.GeneratePassword(7, 0);

            if (RegistroService.RegistraJuez(correoInvitar, sha256(contrasena)))
            {
                var MailService = new MailService();
                if (MailService.EnviarCorreoInvitacionJuez(correoInvitar, contrasena))
                {
                    // Ya envie el correo a ese destinatario
                    MasterPage.ShowMessage("Aviso", "Invitación enviada con éxito.");
                }
                else
                {
                    // No pude enviar el correo a ese destinatario
                    MasterPage.ShowMessage("Error", "El correo no pudo enviarse a ese destinatario, verifica que el correo sea el correcto.");
                }
            }
        }
Example #3
0
        protected void Registro_Click(object sender, EventArgs e)
        {
            String password1          = passreg.Text;
            String password2          = passreg2.Text;
            String correo             = email.Text;
            String codigoConfirmacion = Guid.NewGuid().ToString();

            if (email.Text == "" || passreg.Text == "" || passreg2.Text == "" || name.Text == "" || lname.Text == "")
            {
                MasterPage.ShowMessage("Error", "Debes llenar todos los campos.");
            }
            else if (password1.Equals(password2))
            {
                Regex regexNumero = new Regex(@".*\d.*");
                Regex regexLetra  = new Regex(@".*[a-zA-z].*");
                Regex regexCorreo = new Regex(@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$");
                Match matchNumero = regexNumero.Match(password1);
                Match matchLetra  = regexLetra.Match(password1);
                Match matchCorreo = regexCorreo.Match(correo);

                if (!matchCorreo.Success)
                {
                    MasterPage.ShowMessage("Error", "Dirección de correo no válida.");
                }
                else
                {
                    if (password1.Length < 6 || !matchNumero.Success || !matchLetra.Success)
                    {
                        MasterPage.ShowMessage("Error", "Contraseña debe ser de al menos 6 caracteres y debe contener al menos un número y una letra.");
                    }
                    else if (RegistroService.RegistraCandidato(email.Text, sha256(password1), name.Text, lname.Text, codigoConfirmacion))
                    {
                        var MailService = new MailService();
                        if (MailService.EnviarCorreoConfirmacion(email.Text.ToString(), codigoConfirmacion))
                        {
                            ScriptManager.RegisterStartupScript(Page, typeof(Page), "setCookieInicio2", "setCookie('tab', 'inicio');", true);
                            ScriptManager.RegisterStartupScript(Page, typeof(Page), "setSelectedTab2", "autoChangeTab();", true);
                            MasterPage.ShowMessage("Aviso", "Se envió un mail al correo registrado. Favor de confirmar cuenta.");
                        }
                        else
                        {
                            MasterPage.ShowMessage("Error", "Dirección de correo no válida.");
                        }
                    }
                    else
                    {
                        MasterPage.ShowMessage("Error", "Ya existe un usuario registrado a ese correo.");
                    }
                }
            }
            else
            {
                MasterPage.ShowMessage("Error", "Contraseñas no coinciden.");
            }
        }
Example #4
0
        // POST: api/Registro
        public Registro Post([FromBody] Registro value)
        {
            //var path = Path.Combine(HttpContext.Current.Server.MapPath("foede"), "name");
            RegistroService servicio = new RegistroService(cadenaConexion);

            //subir iagen
            if (value.ImageArray != null && value.ImageArray.Length > 0)
            {
                var stream   = new MemoryStream(value.ImageArray);
                var guid     = Guid.NewGuid().ToString();
                var file     = $"{guid}.jpg";
                var folder   = "~/Content/Usuarios";
                var fullPath = $"{folder}/{file}";
                var response = FilesHelper.UploadPhoto(stream, folder, file);

                if (response)
                {
                    value.foto = file;
                }
            }

            if (value.IdentificacionArray != null && value.IdentificacionArray.Length > 0)
            {
                var stream   = new MemoryStream(value.IdentificacionArray);
                var guid     = Guid.NewGuid().ToString();
                var file     = $"{guid}.jpg";
                var folder   = "~/Content/Iden";
                var fullPath = $"{folder}/{file}";
                var response = FilesHelper.UploadPhoto(stream, folder, file);

                if (response)
                {
                    value.identificacion = file;
                }
            }

            if (value.ComprobanteArray != null && value.ComprobanteArray.Length > 0)
            {
                var stream   = new MemoryStream(value.ComprobanteArray);
                var guid     = Guid.NewGuid().ToString();
                var file     = $"{guid}.jpg";
                var folder   = "~/Content/Com";
                var fullPath = $"{folder}/{file}";
                var response = FilesHelper.UploadPhoto(stream, folder, file);

                if (response)
                {
                    value.comprobanteDomiciliario = file;
                }
            }

            return(servicio.PostRegistro(value));
        }
        public void deve_MontarObjetoDeRegistroDaMaquina_QuandoNecessario()
        {
            //arrange
            RegistroService service = new RegistroService();

            //act
            RegistroModel registro = service.RegistrarInformacoesMaquina();

            //asserts
            Assert.Equal("LEONARDO", registro.Nome_Maquina);
            Assert.Equal("192.168.0.4", registro.IP);
            Assert.Equal("Windows Defender", registro.AntiVirus);
            Assert.Equal(2, registro.Discos.Count);
            Assert.Equal("Microsoft Windows NT 10.0.19041.0", registro.Versao_Windows);
            Assert.Equal("3.1.8", registro.Versao_DotNet);
            Assert.Equal(3, registro.Firewall.Count);
        }
Example #6
0
 public HomeController(RegistroService registroService, TagService tagService)
 {
     this.tagService      = tagService;
     this.registroService = registroService;
 }
 public RegistroController(ILogger <RegistroController> logger, RegistroService registroService)
 {
     _logger          = logger;
     _registroService = registroService;
 }
 public RegistroController(RegistroService registro, IToastNotification toast)
 {
     _registroService = registro;
     _toast           = toast;
 }
Example #9
0
 /// <summary>
 /// Construtor padrão para iniciar a API
 /// </summary>
 /// <param name="service">Camada de Serviços de Registro</param>
 public RegistroController(RegistroService service)
 {
     _service = service;
 }
 public RegistroController(RegistroService registroService)
 {
     _registroService = registroService;
 }