private String compareUserPassword(HttpServletRequest request) { HttpSession session = request.getSession(true); String check = ""; String email = session.getAttribute("SessionEmail").toString(); // Current Password // String password = request.getParameter("password"); // New Password String password1 = request.getParameter("password1"); String password2 = request.getParameter("password2"); String password1Encrypted = cabl.encryptPassword(password1); String password2Encrypted = cabl.encryptPassword(password2); System.out.println(email); System.out.println(password1); System.out.println(password2); // Check new passwords if they are the same if (password1Encrypted.equals(password2Encrypted)) { // check if current password matches the database password System.out.println("Profile Editing in Progress"); cabl.updatePassword(email, password1); check = "Success: Password has been updated."; } else { check = "Error: The passwords you entered do not match."; } return check; }