This project provides a fully functional Login, Register, and Logout system built with Node.js. It aims to offer a secure and robust user authentication system that can be integrated into various web applications.It aims to offer a secure and robust user authentication system that can be integrated into various web applications.
- User Registration: Allows users to create a new account with a secure password.
- User Login: Enables users to log in to the application using their registered credentials.
- User Logout: Provides a secure way for users to log out of the application.
- Password Encryption: Ensures all user passwords are properly hashed and encrypted for security.
- Session Management: Utilizes Passport for managing user sessions.
Follow these instructions to set up the project locally.
Ensure you have the following installed:
-
Download or clone the repository to your local machine.
-
Navigate to the project directory:
cd user-authentication-system
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory of the project and add the following environment variables:PORT=3000 SESSION_SECRET=your_secret_key
Make sure to replace
your_secret_key
with a strong secret key for session management.
-
Start the application:
npm start
-
Open your browser and navigate to
http://localhost:3000
.
- Register: Visit
/register
to create a new account. - Login: Visit
/login
to log in with your credentials. - Logout: Click the logout button to end the session.
- All passwords are hashed using bcryptjs to ensure they are stored securely.
- Sessions are managed using secure cookies to prevent unauthorized access.
For further details on the technologies used in this project, refer to the following documentation:
- Node.js Documentation
- Express Documentation
- Passport Documentation
- bcryptjs Documentation
- express-session Documentation
- express-validator Documentation
- MySQL Documentation
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.