Skip to content

A clean and secure API endpoint that lets authenticated users update their password using JWT and bcrypt. Built with Flask, SQLAlchemy, and Docker in mind.

Notifications You must be signed in to change notification settings

Talabov/Flask-Secure-Password-Update-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🔐 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.

About

A clean and secure API endpoint that lets authenticated users update their password using JWT and bcrypt. Built with Flask, SQLAlchemy, and Docker in mind.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published