# 🔐 Building a Password Strength Checker

## 🔐 Building a Password Strength Checker with Flask and HTML

### 🧩 Overview

In today’s digital world, protecting your online accounts begins with one crucial step — choosing a **strong password**. To help users evaluate their passwords easily, I built a **Password Strength Checker** using **Flask (Python)** and a stylish **HTML/CSS frontend**.

---

### ⚙️ Technologies Used

* **Python (Flask)** – For handling backend logic
    
* **HTML & CSS** – For designing the frontend
    
* **Regex (Regular Expressions)** – For validating password strength
    
* **Particles.js** – To create an interactive neon background
    

---

### 💡 Project Logic

The password strength is analyzed based on five criteria:

1. Minimum length of 8 characters
    
2. At least one uppercase letter
    
3. At least one lowercase letter
    
4. At least one number
    
5. At least one special character
    

Depending on these conditions, the app classifies the password as:

* **💪 Strong**
    
* **🙂 Moderate**
    
* **😢 Weak**
    

---

### 🧠 Core Python Function

Here’s the main logic that performs password strength checking:

```plaintext
def check_password_strength(password):
    length_error = len(password) < 8
    uppercase_error = re.search(r"[A-Z]", password) is None
    lowercase_error = re.search(r"[a-z]", password) is None
    digit_error = re.search(r"\d", password) is None
    special_char_error = re.search(r"[!@#$%^&*(),.?\":{}|<>]", password) is None

    feedback = []
    if length_error:
        feedback.append("❌ Must be at least 8 characters long.")
    if uppercase_error:
        feedback.append("❌ Must include at least one uppercase letter.")
    if lowercase_error:
        feedback.append("❌ Must include at least one lowercase letter.")
    if digit_error:
        feedback.append("❌ Must include at least one number.")
    if special_char_error:
        feedback.append("❌ Must include at least one special character (!@#$%^&*(),.?\":{}|<>).")

    errors = sum([length_error, uppercase_error, lowercase_error, digit_error, special_char_error])
    if errors == 0:
        strength = "💪 Strong"
    elif errors <= 2:
        strength = "🙂 Moderate"
    else:
        strength = "😢 Weak"

    return feedback, strength
```

---

### 🎨 Frontend Design

The interface has a **cyberpunk theme** with glowing animations and a **floating particle background** for visual appeal.  
It displays personalized feedback like:

```plaintext
❌ Must include at least one number.
❌ Must include at least one special character.
🙂 Moderate
```

Users can instantly see how their password measures up.

---

### 🚀 How to Run the Project

1. Install dependencies:
    
    ```plaintext
    pip install flask
    ```
    
2. Run the Flask app:
    
    ```plaintext
    python app.py
    ```
    
3. Open your browser and visit:
    
    ```plaintext
    http://127.0.0.1:5000/
    ```
    

---

### 💭 Final Thoughts

This project taught me how to:

* Use **Flask** for backend web applications
    
* Implement **form handling and validation**
    
* Create **dynamic UI feedback** with Jinja2 templating
    
* Add **visual effects** using CSS animations and JavaScript libraries
    

You can extend this project by adding:

* A **password generator**
    
* A **meter bar** for strength visualization
    
* **AJAX** for real-time password checking
