This is a simple login system implemented using Express.js and MongoDB, with password hashing for security.
- Signup: Allows users to create new accounts by providing their name, email, and password.
- Login: Enables registered users to log in using their email and password.
- Password Hashing: Securely hashes passwords using bcrypt before storing them in the database.
- Validation: Validates user input for signup and login forms.
- Error Handling: Provides error messages for incorrect login attempts and internal server errors.
- Express.js: Fast, unopinionated, minimalist web framework for Node.js.
- MongoDB: NoSQL database used for storing user data.
- Mongoose: MongoDB object modeling tool for Node.js.
- bcrypt: Library for hashing passwords.
- express-validator: Middleware for input validation in Express.js.
-
Clone the Repository:
git clone https://github.com/your-username/login-system.git
-
Install Dependencies:
cd login-system npm install
-
Configure MongoDB:
- Make sure MongoDB is installed and running on your system.
- Update the connection string in
app.js
to point to your MongoDB instance.
-
Run the Application:
npm start
The application should now be running on
http://localhost:8080
.
-
Signup:
- Navigate to
http://localhost:8080/signup
. - Fill in the signup form with your name, email, and password.
- Click the "Register" button to create your account.
- Navigate to
-
Login:
- Navigate to
http://localhost:8080/login
. - Enter your email and password in the login form.
- Click the "Login" button to log in.
- Navigate to
Contributions are welcome! Please feel free to submit a pull request or open an issue if you encounter any problems or have suggestions for improvements.
This project is licensed under the MIT License.