Youn
Youn

Reputation: 83

How to implement Email validation using Apex?

I'm working on Apex and I'm trying to implement an email validation process. When the user subscribes he will receive a mail with a link to validate his account.

The way I'm planning to do it is :

In the table Users, create two columns that are filled with unique random 20 character codes Column1, Column 2 that are 20-character long;

For example

Then create a public page with two hidden items; Let's say :

In the email there will be a link to open the page and fill out these two non protected fields:

apex:

www.domain.com/f?p=App:MyPageID:Field1,Field2:Code1,Code2

The user will then click submit.

An internal process will search in the table Users and check if there is a new user whom Column 1 & 2 correspond to these two code.

If it's the case, then validate the account, else throw error.

Is this implementation safe please ?

Thanks in advance.

Upvotes: 0

Views: 320

Answers (1)

Phanny
Phanny

Reputation: 221

I would like to add prevent URL tampering by adding checksum in your url and in page level.

Upvotes: 1

Related Questions