Skip to content

About

Login and sign-up system built with Flask.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Login System Using Flask

A small Flask web application with user sign-up, login and logout, where each signed-in user can add and delete their own text notes. Data is stored in a local SQLite database.

Login page

Features

  • Sign up with email, first name and password (with confirmation)
  • Log in and log out (sessions handled by Flask-Login, "remember me" enabled)
  • Passwords are stored only as salted hashes (Werkzeug generate_password_hash), never in plain text
  • Basic validation on sign-up: email of at least 4 characters, first name of at least 2 characters, matching passwords, password of at least 7 characters, and no duplicate emails
  • Notes page (login required): add notes and delete your own notes
  • Flash messages for success and error feedback

Tech stack

Setup

git clone https://github.com/digantadatta/Login-System-Using-Flask.git
cd Login-System-Using-Flask

python -m venv .venv
# Windows:  .venv\Scripts\activate
# macOS/Linux:  source .venv/bin/activate

pip install -r requirements.txt

Configuration

The app reads these environment variables:

Variable Purpose Default
SECRET_KEY Signs session cookies. Set this to a long random value in production. An insecure development key (a warning is logged)
FLASK_DEBUG Set to 1 to run with the Flask debugger and reloader (development only) Off

Generate a secret key with:

python -c "import secrets; print(secrets.token_hex(32))"

Run

# macOS/Linux
SECRET_KEY=your-secret FLASK_DEBUG=1 python main.py

# Windows PowerShell
$env:SECRET_KEY = "your-secret"; $env:FLASK_DEBUG = "1"; python main.py

Then open http://127.0.0.1:5000/ . On first start the SQLite database is created at website/database.db.

Project structure

.
├── main.py                 # Entry point (python main.py)
├── requirements.txt        # Python dependencies
├── website/
│   ├── __init__.py         # Application factory, config, database creation
│   ├── auth.py             # /login, /logout, /sign-up routes
│   ├── views.py            # / (notes page) and /delete-note routes
│   ├── models.py           # User and Note models
│   ├── static/index.js     # Client-side note deletion
│   └── templates/          # base, home, login and sign_up templates
├── LICENSE
└── .github/workflows/ci.yml   # CI: compile, flake8, smoke test

Usage example

  1. Open /sign-up, enter an email, first name and a password of at least 7 characters, and submit. You are signed in and taken to the notes page.
  2. Type a note in the text area and press Add Note. It appears in the list.
  3. Click the x next to a note to delete it.
  4. Use Logout in the navigation bar; log back in later from /login.

Notes and limitations

This is a learning project. Before exposing it publicly, consider adding CSRF protection (for example Flask-WTF), rate limiting on login, and serving it with a production WSGI server rather than python main.py.

License

Released under the MIT License.

About

Login and sign-up system built with Flask.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages