MCPcopy Create free account
hub / github.com/OWASP/SecurityShepherd / updatePassword

Method updatePassword

src/main/java/dbProcs/Setter.java:626–650  ·  view source on GitHub ↗

@param ApplicationRoot The current running context of the application @param userName User name of the user @param currentPassword User's current password @param newPassword New password to use in update @return ResultSet that contains error details if not successful

(String ApplicationRoot, String userName, String currentPassword, String newPassword)

Source from the content-addressed store, hash-verified

624 * @return ResultSet that contains error details if not successful
625 */
626 public static boolean updatePassword (String ApplicationRoot, String userName, String currentPassword, String newPassword)
627 {
628 log.debug("*** Setter.updatePassword ***");
629
630 boolean result = false;
631 Connection conn = Database.getCoreConnection(ApplicationRoot);
632 try
633 {
634 log.debug("Preparing userPasswordChange call");
635 CallableStatement callstmnt = conn.prepareCall("call userPasswordChange(?, ?, ?)");
636 callstmnt.setString(1, userName);
637 callstmnt.setString(2, currentPassword);
638 callstmnt.setString(3, newPassword);
639 log.debug("Executing userPasswordChange");
640 callstmnt.execute();
641 result = true;
642 }
643 catch(SQLException e)
644 {
645 log.error("updatePassword Failure: " + e.toString());
646 }
647 Database.closeConnection(conn);
648 log.debug("*** END updatePassword ***");
649 return result;
650 }
651
652 /**
653 * Updates a player's password without needing the current password

Callers 3

testUpdatePasswordMethod · 0.95
doPostMethod · 0.95

Calls 2

getCoreConnectionMethod · 0.95
closeConnectionMethod · 0.95

Tested by 2

testUpdatePasswordMethod · 0.76