← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17730: Removed code for detecting whether password had changed for user credentials that simply did not ...

 

------------------------------------------------------------
revno: 17730
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-12-18 20:29:39 +0100
message:
  Removed code for detecting whether password had changed for user credentials that simply did not work. When comparing a persisted argument instance with another instance retrieved from hibernate with the same id, one will be referring to the same instance from the hibernate session. Must be fixed properly.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserCredentialsStore.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserCredentialsStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserCredentialsStore.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserCredentialsStore.java	2014-12-18 19:29:39 +0000
@@ -86,19 +86,9 @@
     @Override
     public void updateUserCredentials( UserCredentials userCredentials )
     {
-        Session session = sessionFactory.getCurrentSession();
-
-        User persistedUser = userService.getUser( userCredentials.getUser().getUid() );
-
-        if ( persistedUser != null && persistedUser.getUserCredentials() != null
-            && persistedUser.getUserCredentials().getPassword() != null
-            && userCredentials.getPassword() != null
-            && !persistedUser.getUserCredentials().getPassword().equals( userCredentials.getPassword() ) )
-        {
-            userCredentials.setPasswordLastUpdated( new Date() );
-        }
-
-        session.update( userCredentials );
+        userCredentials.setPasswordLastUpdated( new Date() ); //TODO only update when password changed
+        
+        sessionFactory.getCurrentSession().update( userCredentials );
     }
 
     @Override