Skip to main content

AppScriptify — Login template (simple)

This small project provides a basic login/signup template using Flask and MongoDB (via Motor). It stores users in a MongoDB collection and uses secure password hashing (PBKDF2). The login can accept either username or email.

What it uses

  • Flask — web framework
  • Motor (async MongoDB driver) — async access to MongoDB
  • python-dotenv — load environment variables

Files of interest

  • appscriptify/appscriptify/templates/login/app.py — main Flask app used in this template
  • appscriptify/appscriptify/templates/login/database.py — async database helpers (Motor)
  • config.json — contains database/collection names (already present in the repo)
  • templates/ and static/ — UI HTML/CSS/JS

Environment variables

Create a .env file in the project root with at least:

MONGO_URI="your_mongo_connection_string"

Example .env content:

MONGO_URI="mongodb+srv://testuser:<password>@testdb.ktuizkl.mongodb.net/?appName=TestDB"

Also ensure config.json (already present) contains the database and collection names. Example values are:

{
  "users_database": "usersDB",
  "users_collection": "users"
}

Change config.json if needed.

Install

  1. (Optional) Create a virtual environment:
python -m venv .venv
.\.venv\Scripts\activate
  1. Install dependencies:
python -m pip install -r requirements.txt

Run (development)

Open a terminal and run the Flask app file used in the template. From the repository root you can run:

python app.py

This will start Flask's built-in server on http://127.0.0.1:5000 by default.

Alternatively, you can set FLASK_APP and use flask run after setting the working directory appropriately.

Cookies & Sessions

  • The app sets HTTP-only cookies for username/email by default (good for preventing JavaScript access).
  • In development the cookie secure flag is set to False to allow non-HTTPS testing. In production change it to True.
  • The app also stores minimal session info using Flask's session (server-side cookie signing). Make sure app.secret_key is set in production using an environment variable.

Notes and security

  • Passwords are hashed with PBKDF2 + SHA256 via Python's hashlib and stored as base64(salt + hash). This is reasonably secure for a small project but using a well-maintained library (like passlib) is recommended for production.
  • Motor is async; the example app uses a single event loop and runs async DB calls from synchronous routes. For production consider using an async-capable web server/framework (Quart/FastAPI) or rewrite routes as fully sync using pymongo.
  • Make sure your MongoDB connection string is secure and credentials are not committed to the repo.

Next steps (suggested)

  • Add a /logout route that clears cookies and session (I can add that for you).
  • Add CSRF protection (e.g., Flask-WTF or a middleware) for forms.
  • Replace manual cookie handling with Flask's session-related features or a secure server-side session store.
  • Add tests for signup/login flows.

Metadata

Release files for appscriptify 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for appscriptify 1.3.0
File Size Uploaded
appscriptify-1.3.0.tar.gz 28.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for appscriptify 1.3.0
File Interpreter ABI Platform
appscriptify-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 63.8 kB

Release files / appscriptify-1.3.0.tar.gz

Download URL appscriptify-1.3.0.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4638b9d8e0c85229fd8aca01df9da0508e1080880c13f9c3daf3bbf239cc1f02
BLAKE2b-256 checksum
How to use checksums
9c7953b3f0c6bfb84e463bffc312ed8b3765a56c7703be653338f1d21c27f5fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / appscriptify-1.3.0-py3-none-any.whl

Download URL appscriptify-1.3.0-py3-none-any.whl
Size 35.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17a72620fc282cd0aa2e49c6bd45d2d3d7208aac95cd2171e3b5ff4883a69f7e
BLAKE2b-256 checksum
How to use checksums
23c4506da8db01858d9d1e45012de34b7ebbac60b8c180f64a210a56c87aa286
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page