Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions src/java/Datos/Autenticacion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package Datos;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import Entidades.Espectador;
import Entidades.StringMD;

public class Autenticacion extends BibliotecaDB{

DatosEspectadores dE= new DatosEspectadores();


public Espectador Login(String Usuario, String Password) throws SQLException, ClassNotFoundException, Exception
{
Password = StringMD.getCadenaEncriptada(Password, StringMD.MD5);
String sql = "SELECT * FROM Usuarios WHERE Usuario= '" + Usuario + "' AND Password= '" + Password + "' AND Estado = 1";
Conectar();
PreparedStatement s = CrearSentencia(sql);
ResultSet rows = Consultar(s);
int idEspectador;
Espectador aux = null;

while (rows.next())
{
idEspectador = rows.getInt("IdUsuario");
aux = dE.BuscarEspectador(idEspectador);
}

Desconectar();

return aux;
}


public boolean ComprobarPassword(Espectador oEspectador) throws SQLException, ClassNotFoundException, Exception
{
boolean rta = false;

if (oEspectador != null)
{
String newpass = StringMD.getCadenaEncriptada(oEspectador.getPassword(), StringMD.MD5);
Espectador aux = dE.BuscarEspectador(oEspectador.getIdEspectador());
String oldpass = aux.getPassword();

if (!newpass.equals(oldpass))
{
rta = true;
}
}

return rta;
}


}
40 changes: 2 additions & 38 deletions src/java/Datos/DatosEspectadores.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,7 @@
public class DatosEspectadores extends BibliotecaDB
{

public Espectador Login(String Usuario, String Password) throws SQLException, ClassNotFoundException, Exception
{
Password = StringMD.getCadenaEncriptada(Password, StringMD.MD5);
String sql = "SELECT * FROM Usuarios WHERE Usuario= '" + Usuario + "' AND Password= '" + Password + "' AND Estado = 1";
Conectar();
PreparedStatement s = CrearSentencia(sql);
ResultSet rows = Consultar(s);
int idEspectador;
Espectador aux = null;

while (rows.next())
{
idEspectador = rows.getInt("IdUsuario");
aux = BuscarEspectador(idEspectador);
}

Desconectar();

return aux;
}


public void AgregarEspectador(Espectador oEspectador) throws SQLException, ClassNotFoundException, Exception
{
Expand Down Expand Up @@ -66,24 +47,7 @@ public void ModificarEspectador(Espectador oEspectador) throws SQLException, Cla
}
}

public boolean ComprobarPassword(Espectador oEspectador) throws SQLException, ClassNotFoundException, Exception
{
boolean rta = false;

if (oEspectador != null)
{
String newpass = StringMD.getCadenaEncriptada(oEspectador.getPassword(), StringMD.MD5);
Espectador aux = BuscarEspectador(oEspectador.getIdEspectador());
String oldpass = aux.getPassword();

if (!newpass.equals(oldpass))
{
rta = true;
}
}

return rta;
}


public void EliminarEspectador(int IdEspectador) throws SQLException, ClassNotFoundException, Exception
{
Expand Down
7 changes: 7 additions & 0 deletions src/java/Datos/Espectador_Mudo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package Datos;

import Entidades.Espectador;

public class Espectador_Mudo extends Espectador {

}
7 changes: 7 additions & 0 deletions src/java/Datos/Espector_Sordo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package Datos;

import Entidades.Espectador;

public class Espector_Sordo extends Espectador {

}