We are using SDL Tridion 2011 SP1 with Java on the presentation side. We have a requirement where we need to expire the Subscription links generated by OE after a given time interval or after first use (by use I mean an actual Profile Update or Change Password). To do this we are maintaining a separate DB table at the presentation side and whenever someone requests a "Forgot Password" email from the website we create an entry in this table. The table has 3 fields as:
- Email Adress
- Active
- Date/Time of link generation
Whenever a user clicks on the link from the email, we get the email address from the parameter (automatically added by OE) and lookup the record from the DB. If the record returns active and date/time is within the link expiration period, we allow the user to update their password, else show them a "Link Expired" message.
Now we have identified two problems with this approach.
- This works only if the email originating due to some user action on the presentation side. This is because then only the record is inserted in the DB
- If a second "Forgot Password" email is requested by the same user, all links generated for this user in the past are activated as the only identification is email address. There is no unique identification for each link generated
In short the following is happening:
- I requested a forgot password
- I received an email, let’s call it (email 1)
- I clicked on the link in the email and everything was fine, however, I did not perform any action. So the link is still valid
- After some time, the link from (email 1) expired, as it should
- I requested a forgot password again
- I received an email (email 2)
- Now the links in (email 1) and in (email 2) are both working, meaning that the link in (email 1) was re-activated, which shouldn’t be happening
Is it possible to add a custom dynamic parameter to the Subscription Management links generated by OE at the time of generating the emails? Is there any other parameter embedded in the encrypted "p" parameter generated by OE that can be used to address this situation?