DZone

In a previous article, I explained how to implement a sign-up view to register new users within the application. In this article, I’ll show you how to generate activation links that you can send to the users so that they can complete the registration process.

Generating a Random Activation Code

The general idea for implementing account activation codes is to generate a random string and store it in the database. You use that string to create a link to your application and send it to the user, for example via e-mail (covered in the next article). When the user clicks the link, you compare the string (or code) with the one you stored in the database, and if they match, you activate the user. So, you need to store two things per user:

Source: DZone