Tuesday, October 16, 2018

How to Reset wcsadmin password

In case you have issues with wcsadmin password and you want to reset the password for wcsadmin, you can follow below steps

Connect to your WCS database:

Get SALT value for wcsadmin

select SALT from userreg where logonId  in ('wcsadmin');


If you do not have decrypted values of MerchantKey, Get Merchantkey for your WCS instance

Follow link : Retrieve Merchantkey 

Go to shell/cmd prompt and change your location to Commerce installation Directory

Example: /opt/IBM/WebSphere/CommerceServer70/bin

Run below command to generate HEX value of Password

wcs_password

Sample command:

./wcs_password.sh Passw0rd 5z9f9xdf5vlz 0123456789abcdef


Your output will be

IBM*

Licensed Materials - Property of IBM

5697-A16

(C) Copyrights by IBM and by other(s) 1978, 1997.  All Rights Reserved.

* Trademark of International Business Machines Corp.

=== Encrypted Password ===

ASCII Format: NCduuFlez5a0rxBfxY+Kef+kDsV1FEaJ3Opy6IzY8PI=
Hex Format: 4E43647575466C657A3561307278426678592B4B65662B6B447356314645614A334F707936497A593850493D

Get the HEX value of Password and update it in userreg table

update userreg set logonpassword ='4E43647575466C657A3561307278426678592B4B65662B6B447356314645614A334F707936497A593850493D' where logonId = 'wcsadmin';

commit;

In case you get, your account is disabled message, enable your user account by running:

update userreg set status =1 where logonId ='wcsadmin';

commit;

WebSphere commerce Retrieve MerchantKey


There are multiple ways to retrieve MerchantKey of WCS instance. Below is one of the easiest way to retrieve it.

In order to retrieve MerchatKey for WCS, you can create a test jsp. and put below content in the JSP:

<%@ page import="com.ibm.commerce.util.nc_crypt" %>
Encrypted Value of Merchant Key: <%=com.ibm.commerce.server.WcsApp.configProperties.getValue("Instance/MerchantKey")%>
Plain text (Decrpyted Value) Merchant Key: <%=nc_crypt.decrypt(com.ibm.commerce.server.WcsApp.configProperties.getValue("Instance/MerchantKey"), null)%>

Make sure that newly created JSP is directly accessible. 
If you do not want to create a new JSP, just embedd these 3 lines of code in any JSP which you can render on webpage.