A secure web-based password management system built with Flask that provides both web interface and JSON API endpoints for password operations.
- π Secure Password Hashing: Uses SHA-256 for password hashing
- π Web Interface: Beautiful, responsive web interface built with Bootstrap
- π Password Change: Change your password with old password verification
- β Password Verification: Verify if your current password is correct
- π JSON API: RESTful API endpoints for programmatic access
- π± Mobile Responsive: Works seamlessly on desktop and mobile devices
pip install -r requirements.txtCopy the example environment file and configure it:
cp example.env .envEdit .env if needed (default configuration should work fine).
python app.pyThe application will be available at http://localhost:5000
- Access the main dashboard at
http://localhost:5000 - Choose between changing password or verifying password
- Navigate to
http://localhost:5000/change_password - Enter your current password
- Set a new password
- Confirm the new password
- Navigate to
http://localhost:5000/verify_password - Enter your password to verify if it's correct
POST /api/change_password
Content-Type: application/json
{
"old_password": "your_current_password",
"new_password": "your_new_password"
}Response:
{
"success": true,
"message": "Password changed successfully"
}POST /api/verify_password
Content-Type: application/json
{
"password": "your_password"
}Response:
{
"success": true,
"message": "Password verification successful"
}python tests.pyAuthOm/
βββ app.py # Main Flask application
βββ main.py
βββ templates/ # HTML templates
β βββ base.html
β βββ index.html
β βββ change_password.html
β βββ verify_password.html
βββ data/ # Data storage
βββ tests/ # Test files
βββ requirements.txt # Python dependencies
βββ .env
βββ README.md
-
Clone the repository
git clone https://github.com/OmGoyal27/AuthOm.git cd AuthOm -
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
cp example.env .env
Edit
.envto set your password file path if needed. -
Initialize the password file The system will automatically create the password file with a default empty password hash on first run.
Run the main application to change your password:
python app.pyThe application will:
- Prompt for your current password
- Verify it against the stored hash
- Prompt for a new password
- Update the stored password hash
The main.py module provides several key functions:
hash_password_sha256: Converts plain text to SHA-256 hashget_password_hash_from_user: Securely prompts user for password and returns hashdoesPasswordHashMatch: Verifies if provided hash matches stored passwordupdate_password_hash: Updates stored password hash after verification
python tests.pyThe test suite includes verification of:
- SHA-256 hashing accuracy
- Empty password handling
- Complex password scenarios
- Password Masking: Uses
getpassto hide password input - Hash Verification: Verifies old password before allowing changes
- Secure Storage: Only stores SHA-256 hashes, never plain text passwords
- Default Security: Creates secure default hash for empty passwords
| Variable | Description | Example |
|---|---|---|
PASSWORD_FILE_PATH |
Path to password hash storage file | "data/hashed_passwords.txt" |
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Om Goyal
- SHA-256 Hashing: All passwords are hashed using SHA-256 before storage
- No Plain Text Storage: Passwords are never stored in plain text
- Environment Configuration: Sensitive paths configurable via environment variables
- Input Validation: Both client-side and server-side validation
- Secure Sessions: Flask sessions for web interface security
Environment variables (set in .env file):
PASSWORD_FILE_PATH: Path to the file where hashed passwords are stored (default:data/hashed_passwords.txt)
Change Password:
curl -X POST http://localhost:5000/api/change_password \
-H "Content-Type: application/json" \
-d '{"old_password": "oldpass", "new_password": "newpass"}'Verify Password:
curl -X POST http://localhost:5000/api/verify_password \
-H "Content-Type: application/json" \
-d '{"password": "yourpassword"}'import requests
# Change password
response = requests.post('http://localhost:5000/api/change_password',
json={'old_password': 'oldpass', 'new_password': 'newpass'})
print(response.json())
# Verify password
response = requests.post('http://localhost:5000/api/verify_password',
json={'password': 'yourpassword'})
print(response.json())The Flask app runs in debug mode by default when executed directly:
python flask_app.pyFor production deployment:
- Set a secure secret key in
flask_app.py - Set
debug=False - Use a production WSGI server like Gunicorn:
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 flask_app:app- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
- The system uses SHA-256 for hashing, which is secure for basic authentication needs
- Password hashes and environment files are excluded from version control
- Default empty password hash:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855