Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified planventure-api/instance/planventure.db
Binary file not shown.
4 changes: 1 addition & 3 deletions planventure-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ werkzeug==2.3.7
bcrypt==4.0.1

# Database migrations
Flask-Migrate==4.0.5

pytest==8.3.2
Flask-Migrate==4.0.5
69 changes: 0 additions & 69 deletions planventure-api/utils/test_validators.py

This file was deleted.

39 changes: 0 additions & 39 deletions planventure-api/utils/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,3 @@ def validate_email(email: str) -> bool:
"""Validate email format using regex pattern"""
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
return bool(re.match(pattern, email))

def validate_username(username: str) -> bool:
"""
Validates a username according to the following rules:
- Between 3 and 16 characters
- Starts with a letter or single underscore
- Can contain letters, numbers, and underscores after first character
- No spaces or special characters

Args:
username: The username to validate

Returns:
bool: True if username is valid, False otherwise

Raises:
TypeError: If username is None
"""
if username is None:
raise TypeError("Username cannot be None")

# Check for empty string
if not username:
return False

# Check length (3-16 characters)
if len(username) < 3 or len(username) > 16:
return False

# Pattern explanation:
# ^ - Start of string
# [a-zA-Z_] - First character must be letter or underscore
# (?!_) - Negative lookahead to prevent multiple underscores at start
# [a-zA-Z0-9_] - Remaining characters can be letters, numbers, or underscores
# {2,15} - Length of remaining characters (2-15, plus first character = 3-16 total)
# $ - End of string
pattern = r'^[a-zA-Z_](?!_)[a-zA-Z0-9_]{2,15}$'

return bool(re.match(pattern, username))
Loading