Skip to content

AnasBarakat01/EmailVerification-Laravel

Repository files navigation

When user create an account in your website, you have to ensure that he own the email address he has entered, and he can access this email address. We perform that through sending an activation link to his email address. He has to press this link to verify his account.

                               First step : Design Signup page using HTML, CSS and JavaScript

image

image

4

• Putting HTML elements beside each others through CSS.

• I used CSS to design list of errors provided to user when entered data is invalid.

• I used JavaScript to preview chosen image from user.

• Prevent frequent submissions of the form through disabling the submit button after one click (JavaScript).

• The “address” filed has two select elements connected to each other using JavaScript.

                            Second step : edit “users” table using migration

Add the following columns to "users" table :

a) verified : "0" -> meaning this account is not verified yet (default value). "1" -> this account is verified.

b) activation_code.

c) activation_expiry : the activation_code is valid only for one day.

                                        Third step : validation 

Validate the data user entered in the form using "validate()" function of Laravel. I also used “PHP Regex” patterns to make user create password of my standards . If the validation fails, user will be redirected to the signup page with the data he entered using "session".

                    Fourth step : generate the activation link & send it to user

• Generate the activation code using "random_bytes()" function.

• Calculate the expiration for the activation code using "date()" function.

• Generate the activation link. Like that 'https://app.com/activate.php/email@.com/123456'.

Then store data in the database.

I used “SMTP” protocol and “Mail” class of Laravel to send the activation link to users.

                    sixth step : check the verification

if the activation code came from user and expiration are valid, mark user as verified

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages