Skip to content

anuraagnagar/flask-user-authentication

Repository files navigation

User Authentication System in Flask/Python

A Simple Authentication System Project with basic user functionality in Python Flask with SQLAlchemy.

🧩 Project features & functionality

✅ User Account Management

  • Create an account
  • Log In via username or email
  • Social login with Google OAuth
  • Log out effortlessly

✅ Account Security

  • Email verification for account activation
  • Reset password via secure link
  • Update email with confirmation link

✅ Profile Customization

  • Edit profile details and upload a profile image
  • Change password anytime after log in
  • Set new theme preferences

🧰 Framework & Library

  1. Flask
  2. Flask-Login
  3. Flask-SQLAlchemy
  4. Flask-WTF
  5. Flask-Mail
  6. Flask-Migrate
  7. Flask-Limiter
  8. Bootstrap-Flask
  9. Authlib
  10. Jinja2

⚙️ Prerequisites

Before running this application, ensure you have the following installed:

For local (without Docker) setup, you’ll need:

Make sure to also have:

  • A .env file with required environment variables (see .env.example)

  • Access to required API keys or credentials (e.g., for Flask-mail, OAuth logins, Google re-captcha)

📸 Application Demo Screenshots

Register Page

Register

Login Page

Login

Forgot Password Page

Forgot Password

Reset Password Page

Reset Password

Home Page

Home

Edit Profile Page

Edit Profile

Reset Email Page

Reset Email

Change Password Page

Change Password

Account Setting Page

Change Password

🛠️ Set up project & Run locally.

1. Clone the git repository.

git clone https://github.com/anuraagnagar/flask-user-authentication.git

2. Go to the project directory.

cd flask-user-authentication

Note: To run this project, you will need to change .env.example file to .env on base directory and set the environment variables.

❄️ Run With Docker

You can run this project with Docker. For that, you need to have Docker installed and running on your machine.

To run the project with Docker, follow these steps:

Start the Docker container.

docker compose -f docker/docker-compose-local.yml up

🚀 Or Continue with Normal Setup

3. Create and Activate the virtual environment.

On Windows

python -m venv venv
venv\scripts\activate

On MacOS/Linux/Unix

python3 -m venv venv
source venv/bin/activate

4. Install the requirement packages.

pip install -r requirements.txt

5. Migrate/Create a database.

Note: In some cases, the flask db command might not appear until the application is started with flask run command. Make sure to run this command before proceeding with any database migrations.

Initialize the database migration directory.

flask db init

Run migrate command.

flask db migrate -m "initial_migration"

Upgrade the database for latest migration.

flask db upgrade

6. Creating initial test user.

Create a Initial Test User for our application.

flask createtestuser

7. Last to run the server.

Once the database is set up, you can run the Flask server to start your application.

flask run

To access this application open http://localhost:5000 in your web browser.

🤝 Contributing

Contributions are welcome! If you find a bug or want to add a new feature, please open an issue or submit a pull request. For more information checkout CONTRIBUTING.md

🪪 Licence

By contributing to this project, you agree that your contributions will be licensed under the MIT License.

👤 Author

Anurag Nagar

Releases

No releases published

Packages

No packages published