Modify existing unsubscribe macro?

Kentico Dev asked on October 16, 2019 17:41

Is it possible to modify an existing macro?

Specifically EmailFeed.UnsubscribeFromEmailFeedUrl.

The issue is that I need to create a landing page for a user to see all Newsletters and allow them to check/un-check which ones they want to sub to. The existing functionality only unsubs from whatever newsletter was in the query string.

I just want the macro to generate a url to my new page with a valid hash in the query string that can be verified on the landing page (the clients will not be users in Kentico. The hash is what will validate them and allow subscribing)

Thanks

Correct Answer

Dmitry Bastron answered on October 16, 2019 18:21

Hi Peter,

You can do the following: create your own macro that will generate hash on email address. Here is custom macro tutorial.

And there are Kentico API methods you can use from the code to generate hash and validate it later:

new EmailHashService().GetEmailHash(email);
new EmailHashService().ValidateEmailHash(hash, email);

Also, the following article may be helpful for you (not email, but parameter-based hashing).

1 votesVote for this answer Unmark Correct answer

Recent Answers


Kentico Dev answered on October 16, 2019 20:22

Does EmailHashService().GetEmailHash() use the CMSHashStringSalt value during the hash (or any other salt value)? Can it be considered tamper-proof?

And is it possible for such hashes to have an expiry date?

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on October 16, 2019 20:58

Yes, it uses CMSHashStringSalt so it is tamper proof. But it's not possible to add expiry date for it. It would require to write some code to generate these hashes, store them along with their expiry date and check logic.

0 votesVote for this answer Mark as a Correct answer

Kentico Dev answered on October 16, 2019 21:00

Thanks, Dmitry

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.