Author: bpapez
Date: Wed Jun  6 17:47:21 2007
New Revision: 17482

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17482&repname=
=3Djahia
Log:
issue UNIL-4: Probl=C3=A8me de changement de mot de passe LDAP =


Modified:
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/usermanag=
er/JahiaLDAPUser.java

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/use=
rmanager/JahiaLDAPUser.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/services/usermanager/JahiaLDAPUser.java&rev=
=3D17482&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/usermanag=
er/JahiaLDAPUser.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/usermanag=
er/JahiaLDAPUser.java Wed Jun  6 17:47:21 2007
@@ -375,28 +375,41 @@
     public boolean verifyPassword (String password) {
 =

         if (password !=3D null) {
+                       boolean localLoginResult =3D false;
 =

-            if (!"".equals(mPassword)) {
-                String test =3D JahiaUserManagerService.encryptPassword (p=
assword);
-                return mPassword.equals (test);
-            }
-
-            boolean loginResult =3D JahiaUserManagerLDAPProvider.getInstan=
ce ().login (mUserKey,
-                    password);
-            if (loginResult) {
-                /** @todo here we must now update the properties of the us=
er
-                 *  since he has access to more of his attributes once log=
ged in
-                 */
-                mPassword =3D JahiaUserManagerService.encryptPassword (pas=
sword);
-                return true;
-            }
-            /** @todo insert here LDAP connection check... */
+                       if (mPassword.length() > 0) {
+                               String test =3D 
JahiaUserManagerService.encryptPassword(password);
+                               localLoginResult =3D mPassword.equals(test);
+                       }
+                       // test the provided password with the internal memory 
encrypted
+                       // password.
+                       if (localLoginResult) {
+                               // both passwords match.
+                               return true;
+                       } else {
+                               // the local encrypted password does not match 
the one in
+                               // parameter
+                               // forward to the ldap authN in case of there 
was a ldap
+                               // password change from the last user's visit.
+                               boolean loginResult =3D 
JahiaUserManagerLDAPProvider
+                                               .getInstance().login(mUserKey, 
password);
+                               if (loginResult) {
+                                       /**
+                                        * @todo here we must now update the 
properties of the user
+                                        *       since he has access to more of 
his attributes once
+                                        *       logged in
+                                        */
+                                       mPassword =3D JahiaUserManagerService
+                                                       
.encryptPassword(password);
+                                       return true;
+                               }
+                       }
+                       /** @todo insert here LDAP connection check... */
 =

-        }
+               }
         return false;
     }
 =

-
     /**
      * Return a string representation of the user and it's internal state.
      *

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to