private void btnGuardar_Click(object sender, RoutedEventArgs e) { try { if(!Validate()) return; var pass = new ProyectoSocialEncrypter().EncryptString(txtPass.Password); var admin = new Administradore { Nombre = txtNombre.Text, Apellido = txtApellido.Text, Nick = txtNick.Text, Pass = pass, Confirmar = pass }; var adminBl = new AdministradorBl(); if (adminBl.Agregar(admin) > 0) { MessageBox.Show("El registro se agregó correctamente"); txtNombre.Clear(); txtApellido.Clear(); txtNick.Clear(); txtPass.Clear(); txtConfirmarpass.Clear(); } } catch (Exception ex) { MessageBox.Show("Lo sentimos algo ocurrió mal" + "Advertencia" + ex.Message); } }
public void DecryptString_WrongData_ThrowsException() { const string encrypted = "rtgfs+Jj8="; var pse = new ProyectoSocialEncrypter(); pse.DecryptString(encrypted); }
public void TestEncryptString() { const string text = "text"; const string expected = "7MxiL1v+Jj8="; var actual = new ProyectoSocialEncrypter().EncryptString(text); Assert.AreEqual(expected, actual); }
public bool ValidarAcceso(string userName, string password) { var usuario = ObtenerTodos().FirstOrDefault(u => u.Nick == userName); if (usuario == null) return false; var pse = new ProyectoSocialEncrypter(); var decryptedPassword = pse.DecryptString(usuario.Pass); return password == decryptedPassword; }