Skip to content

Latest commit

 

History

History
121 lines (79 loc) · 2 KB

File metadata and controls

121 lines (79 loc) · 2 KB

🔐 Flask Secure Password Update API


🚀 Need a ready-to-deploy version?

Includes Docker, setup guide, sample responses, and full API structure.

👉 Buy it on Gumroad


A secure and modular Flask API endpoint to change user passwords via JWT authentication. Checks the old password and saves the new one after hashing.


✅ Key Features

  • 🧠 Authenticated password change via JWT
  • 🔐 Validates old_password, stores new_password securely
  • 🧾 Uses bcrypt for password hashing
  • 🚫 Handles missing token, bad credentials, and generic exceptions
  • 🧱 SQLite + Flask-SQLAlchemy integration
  • 🐳 Docker-ready

🚀 Endpoint

Change Password

POST /change-password

Headers:

Authorization: Bearer <your.jwt.token>

Request Body:

{
  "old_password": "currentpassword",
  "new_password": "newsecurepassword"
}

Success Response:

{
  "message": "Password updated"
}

⛔ Error Responses

{ "error": "Authorization token missing or invalid" }

{ "error": "Unprocessable token or malformed request" }

{ "error": "Old password is incorrect" }

⚙️ Requirements

pip install -r requirements.txt
  • Flask
  • Flask-JWT-Extended
  • Flask-SQLAlchemy
  • Flask-Bcrypt

🖥 How to Run

python app.py

Or via Docker:

docker build -t secure-password-update-api .
docker run -p 5000:5000 secure-password-update-api

🧪 Example Screenshots

  • ✅ Valid password update
  • ⚠️ Wrong old password
  • 🛑 Missing or expired JWT

Screenshots saved in /screens


💼 Ready-to-Use Version

Includes full JWT protection, bcrypt hashing, and Docker setup:

👉 Buy it on Gumroad


📬 Contacts


Need this in another language/stack (Node.js, Go, etc)?
Custom dev available — just reach out.