Skip to content

shashankch/AuthenticationSystem

Repository files navigation

AuthenticationSystem

A Complete Authentication System using Node.Js, Express, Passport (Local and Google OAuth2 Strategy) , EJS,MongoDB, Redis (queue), Kue (parallel job), Nodemailer (send mail) and Flash,Noty (display messages).

It allows users to quickly integrate authentication system in their application.

Functionalities:

Sign In Page:

  • Allows user to log in with registered email and password.
  • Forgot Password Option ( to get reset password link on registered user emailID).
  • Social Authentication (Option to Login using Google user account).
  • Creates user on valid google sign in if not already registered.
  • Displays all necessary notifications to user.

Sign Up Page:

  • Allows user to register using name,emailID and password.
  • Allows user to sign up using verified google account.
  • Displays all necessary notifications to user.

Forgot Password Page:

  • Allows user to send reset Password Link to valid registered emailID
  • Generates OneTime-use accessToken for the registered emailID requested for password Reset and send link to user's mail.
  • Displays all necessary notifications to user.

Profile update Page:

  • displays Info like username,emailID,password to loggedIn user
  • Option to reset password and username.
  • Displays all necessary notifications to user on password mismatch,wrong entries etc.

Reset Password Page:

  • Accessible using password Reset Link sent to registered emailID.
  • Allows user to enter new password to update
  • Verifies user using accessToken generated.
  • Displays all necessary notifications to user on password mismatch,wrong entries etc.

Home Page:

  • displays Home Page to only Logged In User.

Steps to run locally:

1. git clone https://github.com/shashankch/AuthenticationSystem.git

2. cd AuthenticationSystem

3. Add generated Google ClienID and Client Secret Key in /config/passport-google-oauth2-strategy.js.

4. Add your emailId and password in /config/nodemailer.js

5. Step 3 and 4 not advisable in production mode. Please follow necessary steps for it.

6. npm install

7. Install MongoDB,Redis and run

8. npm start

Your application should now be running on localhost:8000.

To check Kue-Dashboard to check parallel jobs running on localhost:3000. Type on CLI: ./node_modules/kue/bin/kue-dashboard

Project Structure:

.
├── README.md
├── assets
│   ├── css
│   │   ├── card.css
│   │   ├── header.css
│   │   └── layout.css
│   ├── js
│   └── scss
├── config
│   ├── kue.js
│   ├── middleware.js
│   ├── mongoose.js
│   ├── nodemailer.js
│   ├── passport-google-oauth2-strategy.js
│   └── passport-local-strategy.js
├── controllers
│   ├── home_controller.js
│   └── users_controller.js
├── index.js
├── mailers
│   ├── registration_mailer.js
│   ├── reset_password_mailer.js
│   └── update_password_mailer.js
├── models
│   ├── resetPasswordToken.js
│   └── user.js
├── package-lock.json
├── package.json
├── routes
│   ├── index.js
│   └── users.js
├── views
│   ├── _footer.ejs
│   ├── _header.ejs
│   ├── forgot_password.ejs
│   ├── home.ejs
│   ├── layout.ejs
│   ├── mailers
│   │   ├── password
│   │   │   ├── new_password_reset.ejs
│   │   │   └── new_updatePassword.ejs
│   │   └── registration
│   │       └── new_registration.ejs
│   ├── reset_password.ejs
│   ├── user_profile.ejs
│   ├── user_sign_in.ejs
│   └── user_sign_up.ejs
└── workers
    ├── forgot_password_worker.js
    ├── registration_email_worker.js
    └── reset_password_worker.js

Next Steps:

  • add google RecaptchaV3 in my Authentication System.

Contributing:

  • All contributions are welcome!