Skip to content

Latest commit

 

History

History
96 lines (77 loc) · 3.12 KB

README.md

File metadata and controls

96 lines (77 loc) · 3.12 KB

Spring-Email-Verification

A Spring Boot project to send and verify email using tokens

Prerequisite:

  1. Node.js installed

How to install:

There are two ways by which you can try this out: Easy way is to use Docker:

docker pull ritish56/spring-email-verification

Then, to run the docker image:

docker run -p 8090:8090 ritish56/spring-email-verification

You also need to start Maildev. To do so, in separate terminal, give command:

docker pull maildev/maildev

Then, run the maildev with the required port:

docker run -p 1025:1025 -p 1080:1080 maildev/maildev

And the second way is to clone the repo if you don't have docker. In terminal:

git clone https://github.com/ritish78/Spring-Email-Verification.git

Then, after this repository is installed. Open the project in IDE using Maven. Then in terminal of IDE,

mvn clean install

Before starting the Spring Boot application, you need to install Maildev. To install Maildev, you can follow their Readme for latest updates or you can follow:

First verify if Node is installed or not. In terminal run:

Node -v

If it shows any version like:

v15.14.1

then, Node is installed properly. If not install Node. If Node is installed then in terminal:

npm install -g maildev

Then, after the installation of maildev, type in terminal:

maildev

Maildev should start on Port 1080. Link

Then, run the Spring Boot application by:

mvn spring-boot:run

Tomcat should start on port 8090.

Usage:

{
    "firstName": "Ritish",
    "lastName": "Testing",
    "email": "ritish78@email.com",
    "password": "password"
}

In Postman creating a user

  • Checking the user in database. Here, we are using H2 database. User in database before accepting the token We can see that the user is not enabled by default, as the email verification is not done.

  • Checking the created token in databse. Confirmation Token

  • In Mail Service, we get an email for confirmation: Confirmation Email

  • Then after the user clicks the 'Activate Now' link: After clicking the Activate Now in mail

  • After the activation of the email is successful, we can see in AppUser table, 'Enabled' column is true for the verified user. After the user clicks Activate Now, the email is enabled