Skip to content

Commit

Permalink
Rebase (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerlight071 authored Feb 7, 2024
2 parents 9bbec3f + edb6bc4 commit 906c628
Show file tree
Hide file tree
Showing 14 changed files with 649 additions and 649 deletions.
12 changes: 6 additions & 6 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

## Supported Versions

Right now, only the latest release is being patched for security and performance updates as they are pre-released versions.
Right now, only the latest release is being patched for security and performance updates as they are pre-released versions. The higher the 'x' in the release, the newest release that will contain new patches or adjustments.

| Version | Supported |
| ------- | ------------------ |
| 0.4.0 | :white_check_mark: |
| 0.3.0 | :x: |
| 0.2.0 | :x: |
| 0.1.0 | :x: |
| 0.4.x | :white_check_mark: |
| 0.3.x | :x: |
| 0.2.x | :x: |
| 0.1.x | :x: |

## Reporting a Vulnerability

If you discover a minor security vulnerability, please submit it to our GitHub issues with a clear header. You can [submit issues here](https://github.com/tylerlight071/FurEver_Friends/issues).

For major vulnerabilities or if you prefer, you can also email me directly at tylerlightwood071@gmail.com with "SECURITY VULNERABILITY" in the subject line. Please include the vulnerability issue (title) and, if applicable, the issue number in the subject line.

We will strive to acknowledge your report promptly and keep you informed of its progress and resolution.
We will strive to acknowledge your report promptly and keep you informed of its progress and resolution.
11 changes: 6 additions & 5 deletions add_animal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import time
from colorama import Fore, Style
from common_functions import clear_screen, log_action, get_mongodb_uri, print_animal_table, load_animal_data
from common_functions import clear_screen, log_action, get_mongodb_uri, load_animal_data
from sudo_user import sudo_user
from tables import print_animal_table
from pymongo import MongoClient

# Connect to MongoDB
Expand Down Expand Up @@ -45,19 +46,19 @@ def add_animal():
# Validate input fields
if not all([name, species, breed, gender, age]):
print(Fore.RED + "\nInvalid input. All fields are required." + Style.RESET_ALL)
input(Fore.GREEN + "Press Enter to continue..." + Style.RESET_ALL)
time.sleep(2)
continue

# Validate gender fields
if gender.lower() not in ["male", "female"]:
print(Fore.RED + "\nInvalid input. Gender must be 'Male' or 'Female'." + Style.RESET_ALL)
input(Fore.GREEN + "Press Enter to continue..." + Style.RESET_ALL)
time.sleep(2)
continue

# Validate age as positive integer
if not age.isdigit() or int(age) <= 0:
print(Fore.RED + "\nInvalid age. Please enter a positive integer." + Style.RESET_ALL)
input(Fore.GREEN + "Press Enter to continue..." + Style.RESET_ALL)
time.sleep(2)
continue

age = int(age)
Expand All @@ -81,7 +82,7 @@ def add_animal():

# Confirm successful addition of the animal
print(Fore.GREEN + "\n✨ Animal added successfully! ✨" + Style.RESET_ALL)
log_action(current_user, f"Exited 'Add an animal'")
log_action(current_user, "Exited 'Add an animal'")
time.sleep(2)

# Ask if the user wants to add another animal
Expand Down
26 changes: 1 addition & 25 deletions common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,4 @@ def get_input(prompt):
return value
else:
print(Fore.RED + "\nThis field cannot be left blank. Please try again." + Style.RESET_ALL)
time.sleep(2)


#! One time use until proper implementation
# Function to print the table of animals
def print_animal_table(animals):

# Print table header
print("\n🐾 " + Fore.CYAN + "List of Animals" + Style.RESET_ALL + " 🐾")
print("+-------------------------------------------------------------------------------------------+")
print("| " + Fore.YELLOW + "Name".ljust(20) + Style.RESET_ALL + "| " + Fore.YELLOW + "Species".ljust(8) + Style.RESET_ALL + "| " + Fore.YELLOW + "Breed".ljust(25) + Style.RESET_ALL + "| " + Fore.YELLOW + "Gender".ljust(15) + Style.RESET_ALL + "| " + Fore.YELLOW + "Age".ljust(1) + Style.RESET_ALL + " | " + Fore.YELLOW + "Adopted".ljust(7) + Style.RESET_ALL + " |")
print("+-------------------------------------------------------------------------------------------+")

# Print each animal's data row by row
for animal in animals:
name_column = f"| {animal['name'].ljust(20)}"
species_column = f"| {animal['species'].ljust(8)}"
breed_column = f"| {animal['breed'].ljust(25)}"
gender_column = f"| {animal['gender'].ljust(15)}"
age_column = f"| {str(animal['age']).ljust(3)}"
adopted_column = f"| {str(animal['adopted']).ljust(7)} |"
print(name_column + species_column + breed_column + gender_column + age_column + adopted_column)

# Print table footer
print("+-------------------------------------------------------------------------------------------+")
time.sleep(2)
76 changes: 31 additions & 45 deletions customer_adoption_form_dog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
from common_functions import clear_screen, get_mongodb_uri, get_input
from pymongo import MongoClient

NON_VALID_INPUT = "Please enter a valid option."

# Connect to MongoDB
uri = get_mongodb_uri()
client = MongoClient(uri)

db = client['animal_rescue']
customers_collection = db['customers']


def section_clear():
print(Fore.GREEN + "\nSection Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()

def adopt_dog_form():
# Input validation loop
while True:
Expand All @@ -32,22 +39,22 @@ def adopt_dog_form():
customer_title = get_input("\nTitle (Mr/Mrs/Ms/Dr): ").strip()
# Check title
if customer_title not in ['Mr', 'Mrs', 'Ms', 'Dr']:
print(Fore.RED + "\nPlease enter a valid title." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
customer_name = get_input("Your full name: ").strip()
customer_email = get_input("Your email address: ").strip()
# Check email format
if '@' not in customer_email or '.' not in customer_email:
print(Fore.RED + "\nPlease enter a valid email address." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
customer_phone = get_input("Your phone number: ").strip()
# Check phone number format
if not customer_phone.isdigit() or len(customer_phone) < 10:
print(Fore.RED + "\nPlease enter a valid phone number." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -57,7 +64,7 @@ def adopt_dog_form():

chosen_animal = get_input("\nDo you know which animal are you interested in adopting? ").strip()
if chosen_animal not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -70,15 +77,13 @@ def adopt_dog_form():
elif chosen_animal == 'no':
chosen_animal = "N/A"

print(Fore.GREEN + "\nSection Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()
section_clear()

print(Fore.LIGHTMAGENTA_EX + "\nHousing Details" + Style.RESET_ALL)
own_rent = get_input("\nDo you own or rent your home? ").strip()

if own_rent not in ['own', 'rent']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -88,7 +93,7 @@ def adopt_dog_form():

garden = get_input("\nDo you have a garden? (yes/no/communal): ").strip().lower()
if garden not in ['yes', 'no', 'communal']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -98,19 +103,12 @@ def adopt_dog_form():
garden_fenced = get_input("Is your garden fully fenced? (yes/no): " + Style.RESET_ALL).strip().lower()
garden_access = get_input("How is the garden accessed? " + Style.RESET_ALL).strip()

elif garden == "communal":
garden_size = "N/A"
garden_fenced = "N/A"
garden_access = "N/A"

elif garden == "no":
elif garden == "communal" or garden == "no":
garden_size = "N/A"
garden_fenced = "N/A"
garden_access = "N/A"

print(Fore.GREEN + "\nSection Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()
section_clear()

print(Fore.LIGHTMAGENTA_EX + "\nHousehold Details" + Style.RESET_ALL)

Expand All @@ -119,7 +117,7 @@ def adopt_dog_form():
children_at_address = get_input("Do you have children living at your address? (yes/no): ").strip().lower()

if children_at_address not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -133,7 +131,7 @@ def adopt_dog_form():
visiting_children = get_input("Do children visit your home? (yes/no): ").strip().lower()

if visiting_children not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -144,16 +142,14 @@ def adopt_dog_form():
elif visiting_children == 'no':
visiting_children_age = "N/A"

print(Fore.GREEN + "\nSection Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()
section_clear()

print(Fore.LIGHTMAGENTA_EX + "\nOther Pets" + Style.RESET_ALL)

other_dogs = get_input("\nDo you have any other dogs? (yes/no): ").strip().lower()

if other_dogs not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -175,7 +171,7 @@ def adopt_dog_form():
other_animals = get_input("Do you have any other animals? (yes/no): ").strip().lower()

if other_animals not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -186,9 +182,7 @@ def adopt_dog_form():
elif other_animals == 'yes':
other_animals_type = get_input(Fore.YELLOW + "What type of animals do you have? " + Style.RESET_ALL).strip()

print(Fore.GREEN + "\nSection Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()
section_clear()

print(Fore.LIGHTMAGENTA_EX + "\nExercise and Routine" + Style.RESET_ALL)
weekday_exercise = get_input("\nHow often will the dog be exercised on weekdays? ").strip()
Expand All @@ -197,15 +191,13 @@ def adopt_dog_form():
how_often_alone = get_input("How often will the dog be left alone? ").strip()
alone_time = get_input("How long will the dog be left alone each day? ").strip()

print(Fore.GREEN + "Section Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()
section_clear()

print(Fore.LIGHTMAGENTA_EX + "\nFuture Plans" + Style.RESET_ALL)
moving_plans = get_input("\nDo you have any plans to move in the next 6 months? (yes/no): ").strip().lower()

if moving_plans not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -219,7 +211,7 @@ def adopt_dog_form():
holiday_plans = get_input("Do you have any holiday plans in the near future? (yes/no): ").strip().lower()

if holiday_plans not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -230,9 +222,7 @@ def adopt_dog_form():
elif holiday_plans == 'no':
holiday_timeframe = "N/A"

print(Fore.GREEN + "Section Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()
section_clear()

print(Fore.LIGHTMAGENTA_EX + "\nIdeal Dog" + Style.RESET_ALL)
print(Fore.GREEN + "\nWhat type of dog are you looking for? " + Style.RESET_ALL)
Expand All @@ -256,9 +246,7 @@ def adopt_dog_form():
ideal_dog_training = get_input("Training Needs: ").strip()
ideal_dog_health = get_input("Health Needs: ").strip()

print(Fore.GREEN + "\nSection Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()
section_clear()

print(Fore.LIGHTMAGENTA_EX + "\nOther Requirements" + Style.RESET_ALL)

Expand All @@ -275,7 +263,7 @@ def adopt_dog_form():

other_requirements = get_input(Fore.YELLOW + "\nDo you have any other requirements? (yes/no) " + Style.RESET_ALL).strip()
if other_requirements not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -289,7 +277,7 @@ def adopt_dog_form():
experience = get_input("\nDo you have any experience with dogs? (yes/no) ").strip()

if experience not in ['yes', 'no']:
print(Fore.RED + "\nPlease enter a valid option." + Style.RESET_ALL)
print(Fore.RED + f"\n{NON_VALID_INPUT}" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
continue
Expand All @@ -300,9 +288,7 @@ def adopt_dog_form():
elif experience == 'no':
experience = "N/A"

print(Fore.GREEN + "\nSection Completed." + Style.RESET_ALL)
time.sleep(2)
clear_screen()
section_clear()

print(Fore.LIGHTMAGENTA_EX + "\nConsent to Terms" + Style.RESET_ALL)
signature = get_input("\nPlease enter your full name as a signature: ").strip()
Expand Down
Loading

0 comments on commit 906c628

Please sign in to comment.