cancel
Showing results for 
Search instead for 
Did you mean: 

Customize BackOffice Login Zul and LoginComposer

pavan_joshi1
Participant
0 Kudos

Hello,

We wanted to add password encryption before loginForm submit from Backoffice Login Page(login.zul).
Steps I did:

1. I copied the login.zul file from Backoffice Core JAR and copied it to custombackoffice/resources/cockpitng/login.zul.

2. Since I want to hash password before form submit, I want to customize LoginFormComposer.
Hence, I extended the same to include some methods to be called from login.zul file.

3. But after build, this composer class gives dependency resolution error with Backoffice Core JAR classes.

Could someone suggest if am in right path ?

I even looked at below link, this helps to add some extra login config data just, does not solve my need so...

https://help.sap.com/viewer/5c9ea0c629214e42b727bf08800d8dfa/6.0.0.0/en-US/8bdb6cdd86691014b68ecffbb...

Errors are valid ones since i don't have these libraries in my custom backoffice.
But how would i resolved or add backoffice core JAR library in my extension ?

ERRORS:

[yjavac] 4. ERROR in ******LoginFormComposer.java (at line 9) [yjavac] import org.zkoss.zk.ui.event.ForwardEvent; [yjavac] ^^^^^^^^^ [yjavac] The import org.zkoss cannot be resolved

7. ERROR in *******LoginFormComposer.java (at line 13) [yjavac] import com.hybris.cockpitng.composer.LoginFormComposer; [yjavac] ^^^^^^^^^^^^^^^^^^^^ [yjavac] The import com.hybris.cockpitng cannot be resolved

Thanks !

rbhagat
Employee
Employee
0 Kudos

Hi Pavan

We also have a scenario in which i want to override LoginFormComposer.
It will be great if you could let us know if you were able to do so?

pavan_joshi1
Participant
0 Kudos

Hi Rahul,

No, we dropped this change.

Let me know if anything from your side in SAP. Would be helpful.

Thanks!

rbhagat
Employee
Employee
0 Kudos

Hi Pavan
NOTE : Following will work if you don't have any deprecated cockpit like CMSCockpit,admitCockpit or productCockpit in you localextensions.xml as they contains previous version of zk jars which causes issues on server startup due to conflicting versions.


I have used the same approach you have used for login.zul to change LoginFormComposer and replace it thru Buildcallbacks from a custom extension.
1. To remove the error you have to get zk jars in OOB ${ext.backoffice.path}/web/webroot/WEB-INF/lib/ to ${ext.backofficetraining.path}/lib . After doing this you should have compiled your changes in LoginFormComposer in your extension and will have LoginFormComposer.class available in your backofficetraining extension. If this step is not done properly next steps will not work as well.

2. In Buildcallbacks.xml of backofficetraining extension add the following after_build macrodef tag

<macrodef name="backofficetraining_after_build">
<sequential>
<echo level="info" message="Inside backofficetraining_after_build trying to copy login.zul file" />
<register_sass_extension extensionname="backofficetraining"/>
<register_sass_extension extensionname="backofficetraining" resources="resources" destination=""/>
<echo level="info" message="Inside backofficetraining_after_build trying to copy login.zul file.........." />
<jar destfile="${ext.backoffice.path}/web/webroot/WEB-INF/lib/backoffice-core-20.11.3-RC2.jar" update="yes">
                <zipfileset dir="${ext.backofficetraining.path}/resources"
                            includes="cockpitng/login.zul"
                            fullpath="cockpitng/login.zul"/>
 <zipfileset dir="${ext.backofficetraining.path}/resources"
                            includes="cockpitng/modelWindow.zul"
                            fullpath="cockpitng/"/>
 <zipfileset dir="${ext.backofficetraining.path}/backoffice/classes/com/hybris"
                            includes="cockpitng/composer/LoginFormComposer.class"
                            fullpath="com/hybris/cockpitng/composer/LoginFormComposer.class"/>

            </jar>
<echo level="info" message=".......... Done replacing LoginFormComposer .........." />

3. Do ant clean all and check if ${ext.backoffice.path}/web/webroot/WEB-INF/lib/backoffice-core-20.11.3-RC2.jar updated in your local code.

4. Start Server and check login page it should now reflect your changes done in both ZUL and Composer class.

Hope this helps as this is not a straightforward fix and on some terms SAP commerce will not recommend such an approach as this will hamper future upgrade process when backoffice or zk jar versions gets update in future releases.

Aldali
Explorer
0 Kudos

Hello pavan_joshi, r.bhagat ,

In my previous project I have overcome the problem handling the SAP Commerce upgrade by writing a macrodef. It is highly unlikely that SAP Commerce changes the name pattern of the jar, as observation backoffice-core is always prefixed as such followed by the version no then .jar

<macrodef name="get_backoffice_core_jar_path">
<sequential>
<echo>Getting the full path for the backoffice core jar</echo>
<fileset dir="${ext.backoffice.path}/web/webroot/WEB-INF/lib/"
id="backoffice-core-jar-full-path"
includes="backoffice-core-*.jar" />
<pathconvert property="backoffice-core-jar-path" refid="backoffice-core-jar-full-path" />
</sequential>
</macrodef>


After that you can call this macrodef before the code to modify the jar and use the ${backoffice-core-jar-path} in jar distfile. Below is the full example.

<macrodef name="backofficetraining_after_build">
<sequential>
<echo level="info" message="Inside backofficetraining_after_build trying to copy login.zul file" />
<register_sass_extension extensionname="backofficetraining" />
<register_sass_extension extensionname="backofficetraining" resources="resources" destination="" />
<get_backoffice_core_jar_path></get_backoffice_core_jar_path>
<echo level="info" message="Inside backofficetraining_after_build trying to copy login.zul file.........." />
<jar destfile="${backoffice-core-jar-path}" update="yes">
<zipfileset dir="${ext.backofficetraining.path}/resources" includes="cockpitng/login.zul" fullpath="cockpitng/login.zul" />
<zipfileset dir="${ext.backofficetraining.path}/resources" includes="cockpitng/modelWindow.zul" fullpath="cockpitng/" />
<zipfileset dir="${ext.backofficetraining.path}/backoffice/classes/com/hybris" includes="cockpitng/composer/LoginFormComposer.class" fullpath="com/hybris/cockpitng/composer/LoginFormComposer.class" />

</jar>
<echo level="info" message=".......... Done replacing LoginFormComposer .........." />
</sequential>
</macrodef>



I hope this would help.

Regards,

Accepted Solutions (0)

Answers (0)