Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Saefurukawa committed May 1, 2024
1 parent 6f5a209 commit c03cff3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions HealthHaven/src/org/healthhaven/db/models/AccountDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,17 +546,13 @@ public static synchronized JSONObject updatePassword(Connection conn, String new

private static boolean updateAuthenticationTable(Connection conn, String sql, String password, String userId) {
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
// IMPORTANT: Replace with your password hashing mechanism
String hashedPassword = password;

stmt.setString(1, hashedPassword);

String salt = SaltyHash.genSalt();
stmt.setString(2, salt);
stmt.setString(1, salt);

try {
String hashpass = SaltyHash.pwHash(password, salt);
stmt.setString(3, hashpass);
stmt.setString(2, hashpass);
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Expand All @@ -565,7 +561,7 @@ private static boolean updateAuthenticationTable(Connection conn, String sql, St
e.printStackTrace();
}

stmt.setString(4, userId);
stmt.setString(3, userId);

int rowsUpdated = stmt.executeUpdate();
if (rowsUpdated <= 0) {
Expand Down

0 comments on commit c03cff3

Please sign in to comment.