You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2017/08/26 21:17:45 UTC

svn commit: r1806332 - in /ofbiz: ofbiz-framework/trunk/applications/party/minilang/user/UserEvents.xml ofbiz-plugins/trunk/ecommerce/minilang/customer/QuickAnonCustomerEvents.xml ofbiz-plugins/trunk/scrum/minilang/ScrumEvents.xml

Author: jleroux
Date: Sat Aug 26 21:17:45 2017
New Revision: 1806332

URL: http://svn.apache.org/viewvc?rev=1806332&view=rev
Log:
Fixed:
(OFBIZ-)

Steps to regenerate:
1. Go to Party Component 
	(https://demo-trunk-ofbiz.apache.org:8443/partymgr/control/main)
2. Create on *Create Customer* sub-menu 
	(https://demo-trunk-ofbiz.apache.org:8443/partymgr/control/NewCustomer)
3. Fill all the required fields and click on save button

On further exploring, I found that the HashCrypt.getDigestHash() method doesn't 
exist in HashCrypt.java. The method existed in the earlier version of Ofbiz 
(Ofbiz-16.12):

Expected result: Customer should be created successfully.
Actual result: An error is thrown

Aditya Sharma:  Hi Ayushi,
I think methods were removed at revision 1804880 by Jacques as they were 
deprecated methods which can be replaced with digestHash() methods.
Refer the link: http://markmail.org/message/c6d7ukjaldzpng7l

jleroux: I found another case in UserEvents.xml. I also formatted things a bit

Thanks: Ayushi Rathod for the finding analysis, and patch, Aditya for helping 
Ayushi 

Modified:
    ofbiz/ofbiz-framework/trunk/applications/party/minilang/user/UserEvents.xml
    ofbiz/ofbiz-plugins/trunk/ecommerce/minilang/customer/QuickAnonCustomerEvents.xml
    ofbiz/ofbiz-plugins/trunk/scrum/minilang/ScrumEvents.xml

Modified: ofbiz/ofbiz-framework/trunk/applications/party/minilang/user/UserEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/minilang/user/UserEvents.xml?rev=1806332&r1=1806331&r2=1806332&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/minilang/user/UserEvents.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/minilang/user/UserEvents.xml Sat Aug 26 21:17:45 2017
@@ -124,7 +124,7 @@ under the License.
         <!-- Create the Person -->
         <call-map-processor in-map-name="parameters" out-map-name="personContext">
             <simple-map-processor name="newPerson">
-            	<process field="USER_PARTY_ID"><copy to-field="partyId"/></process>
+                <process field="USER_PARTY_ID"><copy to-field="partyId"/></process>
                 <process field="USER_FIRST_NAME"><copy to-field="firstName"/><not-empty><fail-property resource="PartyUiLabels" property="PartyFirstNameMissing"/></not-empty></process>
                 <process field="USER_MIDDLE_NAME"><copy to-field="middleName"/></process>
                 <process field="USER_LAST_NAME"><copy to-field="lastName"/><not-empty><fail-property resource="PartyUiLabels" property="PartyLastNameMissingError"/></not-empty></process>
@@ -315,7 +315,10 @@ under the License.
             <set field="delegator" from-field="parameters.delegator" type="Object"/>
             <script>groovy:
                 boolean useEncryption = "true".equals(org.apache.ofbiz.entity.util.EntityUtilProperties.getPropertyValue("security", "password.encrypt", delegator))
-                if (useEncryption) { newUserLogin.set("currentPassword", org.apache.ofbiz.base.crypto.HashCrypt.getDigestHash((String) newUserLogin.get("currentPassword"))) }
+                if (useEncryption) {
+                    String hashType = org.apache.ofbiz.common.login.LoginServices.getHashType()
+                    newUserLogin.set("currentPassword", org.apache.ofbiz.base.crypto.HashCrypt.digestHash(hashType, null, newUserLogin.get("currentPassword"))) 
+                }
             </script>
 
             <!-- create the UserLogin manually to get around ordering and security constraints in the service -->

Modified: ofbiz/ofbiz-plugins/trunk/ecommerce/minilang/customer/QuickAnonCustomerEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ecommerce/minilang/customer/QuickAnonCustomerEvents.xml?rev=1806332&r1=1806331&r2=1806332&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ecommerce/minilang/customer/QuickAnonCustomerEvents.xml (original)
+++ ofbiz/ofbiz-plugins/trunk/ecommerce/minilang/customer/QuickAnonCustomerEvents.xml Sat Aug 26 21:17:45 2017
@@ -350,7 +350,10 @@ under the License.
             <!-- If password encryption is enabled, encrpyt it now -->
             <script>groovy:
                 boolean useEncryption = "true".equals(org.apache.ofbiz.base.util.UtilProperties.getPropertyValue("security", "password.encrypt"))
-                if (useEncryption) { newUserLogin.set("currentPassword", org.apache.ofbiz.base.crypto.HashCrypt.getDigestHash((String) newUserLogin.get("currentPassword"))) }
+                if (useEncryption) {
+                    String hashType = org.apache.ofbiz.common.login.LoginServices.getHashType()
+                    newUserLogin.set("currentPassword", org.apache.ofbiz.base.crypto.HashCrypt.digestHash(hashType, null, (String) newUserLogin.get("currentPassword")) 
+                    }
             </script>
             <!-- create the UserLogin manually to get around ordering and security constraints in the service -->
             <set field="userLoginContext.partyId" from-field="partyId"/>

Modified: ofbiz/ofbiz-plugins/trunk/scrum/minilang/ScrumEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/scrum/minilang/ScrumEvents.xml?rev=1806332&r1=1806331&r2=1806332&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/scrum/minilang/ScrumEvents.xml (original)
+++ ofbiz/ofbiz-plugins/trunk/scrum/minilang/ScrumEvents.xml Sat Aug 26 21:17:45 2017
@@ -4224,7 +4224,10 @@
              <!-- If password encryption is enabled, encrpyt it now -->
             <script>groovy:
                 boolean useEncryption = "true".equals(org.apache.ofbiz.base.util.UtilProperties.getPropertyValue("security", "password.encrypt"))
-                if (useEncryption) { newUserLogin.set("currentPassword", org.apache.ofbiz.base.crypto.HashCrypt.getDigestHash((String) newUserLogin.get("currentPassword"))) }
+                if (useEncryption) {
+                    String hashType = org.apache.ofbiz.common.login.LoginServices.getHashType()
+                    newUserLogin.set("currentPassword", org.apache.ofbiz.base.crypto.HashCrypt.digestHash(hashType, null, (String) newUserLogin.get("currentPassword")))
+                }
             </script>
 
             <!-- create the UserLogin -->