This is a Flask Application that implements unique pairs of authentication to the user depending upon their usual device and login timing.
Authentications Involved:
- Password
- Email OTP (by Azure Communication Service)
- TOTP (Time Based OTP)
- Security Question
Technologies Used:
- Azure Communication Service (Email OTP)
- MongoDB (Data and OTP storage)
- Flask (Application)
-
Clone the repository:
git clone https://github.com/Polymath-Saksh/EFA.git cd EFA
-
Create a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate
-
Install the required packages:
pip install -r requirements.txt
-
Create a
.env
file in the root directory of the project and add the following lines with your MongoDB URI and Azure Communication Email connection string:MONGO_URI="your_mongodb_uri" AZURE_COMMUNICATION_CONNECTION_STRING="your_azure_communication_connection_string" SENDER_EMAIL="your_azure_communication_email"
-
Run the Flask application:
flask run
OR
python app.py
- The application provides a registration page where users can create an account by providing a username, email, password, security question, and security answer.
- The login page allows users to log in with their username, password, and security answer.
- Upon successful login, users are redirected to a success page that displays a welcome message.
- The application uses MongoDB to store user information.
- The login workflow includes security question verification and OTP verification.
The application uses different authentication methods based on the time of login and the device being used, as a Decision Tree. The following pairs of conditions and corresponding authentication methods are used:
- Usual time & Known IP: Password Only
- Usual Time & Unknown IP: Password + Email OTP
- Unusual Time & Known IP: Password + TOTP
- Both Unusual Time & Unknown IP: Password + Email OTP + Security Question
- Usual Time: 0800-2000 hours GMT
- Known IP: An IP address that has been previously used by the user to log in
- The MongoDB connection is configured using the
MONGO_URI
specified in the.env
file. - Ensure that the MongoDB URI is correctly set in the
.env
file before running the application. - IP for network access are enabled for the database.
This project is licensed under the MIT License - see the LICENSE file for details.