I have a login program which takes the information from one db and passes it to the other home section, I want to save an encrypted password (bcript) in the db and in the login it says, for example: db: $2a$12$MzhYAeNkuDd/8GaYKPyI5uqe/ANa5sVD3.AdP5TgaFX6MbLTNEkia login: con123

and allow me to enter.

What should I add to it to do all that?

code:


public class CLogin {

private String password ="con123";

public void validateUser(JTextField user, JPasswordField password){
try {
ResultSet rs=null;
PreparedStatement ps= null;

Classes.CConexionConnectionObject = new Classes.CConexion();

String query="select * from user where user.UserLogin =(?) and user.PasswordLogin=(?);";
ps=connectionObject.setConnection().prepareStateme nt(query);

String pass
String contra = String.valueOf(password.getPassword());

ps.setString(1, user.getText());
ps.setString(2,con);

rs = ps.executeQuery();

if (rs.next()) {

JOptionPane.showMessageDialog(null,"User is Correct");
FromMenuMenu object = new FromMenu();
objectMenu.setVisible(true);
if (BCrypt.checkpw()){

}else{

}
}
else
{
JOptionPane.showMessageDialog(null,"User is INCORRECT, TRY AGAIN");
}


} catch (Exception e) {
JOptionPane.showMessageDialog(null,"ERROR: "+e.toString());
}
}