From 3f70aef792c789d6ee0fd2e528ff3940b2154927 Mon Sep 17 00:00:00 2001 From: "Mark H. Wood" Date: Fri, 3 Aug 2012 15:12:29 -0400 Subject: [PATCH] Upgraded hashes were not committed to the database --- .../src/main/java/org/dspace/eperson/EPerson.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dspace-api/src/main/java/org/dspace/eperson/EPerson.java b/dspace-api/src/main/java/org/dspace/eperson/EPerson.java index cca720ebf3..7dcffe9b82 100644 --- a/dspace-api/src/main/java/org/dspace/eperson/EPerson.java +++ b/dspace-api/src/main/java/org/dspace/eperson/EPerson.java @@ -933,7 +933,20 @@ public class EPerson extends DSpaceObject // If using the old unsalted hash, and this password is correct, update to a new hash if (answer && (null == myRow.getStringColumn("digest_algorithm"))) + { + log.info("Upgrading password hash for EPerson " + getID()); setPassword(attempt); + try { + myContext.turnOffAuthorisationSystem(); + update(); + } catch (SQLException ex) { + log.error("Could not update password hash", ex); + } catch (AuthorizeException ex) { + log.error("Could not update password hash", ex); + } finally { + myContext.restoreAuthSystemState(); + } + } return answer; }