Enabling persistent sessions in a single store(WebSphere Commmerce Remenber Me)

本文详细介绍了如何在IBM WebSphere Commerce中启用持久会话,特别是对于消费者直接商店,通过记住用户的登录状态,从而提高用户体验。文章包括了在登录表单和用户注册添加表单中添加必要的参数,以及如何修改URL参数和配置文件来实现持久会话的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.admin.doc/tasks/tsecremem_cd.htm


Securing > Session management > Using cookies for session management > Persistent sessions (Remember Me)

Feedback
Enabling persistent sessions in a single store

Persistent sessions are particularly useful in consumer direct stores, although it is possible to enable B2B direct stores with persistent sessions as well. The steps to enable persistent sessions in the stores only differ in the locations and names of the files that need to be altered. In both cases, the store's Logon and UserRegistrationAdd forms require changes. The steps must be performed for all the stores in the site that need persistent sessions.
Before you begin
Ensure that you have completed the following task:

Enabling persistent sessions globally.

Procedure

In your store's Logon form and the UserRegistrationAdd form, add the rememberMe parameter as shown in the following example:

<form method="post" name="Logon" action="Logon" id="Logon">
...
<input type="checkbox" name="rememberMe" value="true">
Remember Me </input>
...
</form>

Modify the URL parameter of the Logon form from

<input type="hidden" name="URL"
value="OrderItemMove?page=account&URL=OrderCalculate%3FURL%3DLogonForm"
id="WC_Accouid="WC_AccountDisplay_FormInput_URL_In_Logon_1" />

to

<c:choose>

<c:when test="${!empty WCparam.URL}">
<input type="hidden" name="URL"
value="${WCparam.URL}"
id="WC_AccountDisplay_FormInput_URL_In_Logon_1" />
</c:when>
<c:otherwise>
<input type="hidden" name="URL"
value="OrderItemMove?page=account&URL=OrderCalculate%3FURL%3DLogonForm"
id="WC_AccountDisplay_FormInput_URL_In_Logon_1" />
</c:otherwise>
</c:choose>

Note: The value of the id attribute will differ between stores, but the structure of the code fragment will remain consistent.
Optionally, If you want the partially authenticated user's logon ID to be pre-populated in the user name entry field of the logon form, change the following code:

<input size="20" name="logonId" value=""
id="WC_AccountDisplay_FormInput_logonId_In_Logon_1" />

to:

<c:choose>
<c:when test="${!empty param.logonId}">
<input size="20" name="logonId" value="${param.logonId}"
id="WC_AccountDisplay_FormInput_logonId_In_Logon_1" />
</c:when>
<c:otherwise>
<input size="20" name="logonId" value=""
id="WC_AccountDisplay_FormInput_logonId_In_Logon_1" />
</c:otherwise>
</c:choose>

Note: The value of the id attribute will differ between stores, but the structure of the code fragment will remain consistent.
Add the following configuration fragment to the WebSphere Commerce Struts custom configuration file for the Stores module:

<global-forwards>
<forward className="com.ibm.commerce.struts.ECActionForward"
name="RememberMeLogonFormView/
storeID"

path="/UserArea/AccountSection/LogonSubsection/LogonSetup.jsp">

<set-property property="credentialsAccepted"
value="
storeID:
credAccept" />
</forward>

</global-forwards>

<action-mappings
type="com.ibm.commerce.struts.ECActionMapping">

<action path="/RememberMeLogonFormView"
type="com.ibm.commerce.struts.BaseAction">
<set-property property="https" value="
storeID:1" />
<set-property property="credentialsAccepted" value="
storeID:
credAccept" />
</action>

</action-mappings>

Where:

storeID
The store ID of the store for which you are enabling the persistent session. This value can be found in the STORE table.
credAccept
P to mean that remembered registered users are entitled to accessing this resource without authenticating themselves, or any other value (including NULL) to mean that they must authenticate themselves.

Update actions for all the URLs that remembered registered users are entitled to access without authenticating themselves by setting their credentialsAccepted property to storeID :P.
Update the PERSISTENTSESSION column in the STORE table in order to enable the persistent session:
Open a session to your database.
Find the STORE_ID of the store you are enabling persistent session for by entering the following SQL statement into the session:

SELECT * FROM STORE

Enter the following SQL statement into your database:

UPDATE STORE SET PERSISTENTSESSION =
configValue WHERE STORE_ID =
store
ID


Where:

storeID
The ID of the store for which you are enabling persistent session.
configValue
A value from the following list that represents the appropriate configuration:

0
The rememberMe function is disabled for registered customers and guest customers. This is the default value.
1
The rememberMe function is enabled for registered customers only.
2
The rememberMe function is enabled for guest customers only.
3
The rememberMe function is enabled for registered customers and guest customers.

Related concepts:
Users
Session management
Persistent sessions (Remember Me)
Personalization ID
time stampLast updated: 18 April 2013 Tweet
Topic URL: http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.admin.doc/tasks/tsecremem_cd.htm Share
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值