summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-12 15:07:59 -0500
committerBen Sima <ben@bsima.me>2025-11-12 15:07:59 -0500
commitee1138b39b9709871adcb97b915d5944cd2091c9 (patch)
tree9a004dbae08ae4a1dc48847a74faf42ed142d8d3 /Biz
parent2e3d0626341291dd71a92ed58815616d4e276dca (diff)
Remove manual approval requirement for new accounts
New accounts now default to 'active' status instead of 'pending'. Users can start using the service immediately after signup.
Diffstat (limited to 'Biz')
-rw-r--r--Biz/PodcastItLater/Core.py14
-rw-r--r--Biz/PodcastItLater/Web.py9
2 files changed, 8 insertions, 15 deletions
diff --git a/Biz/PodcastItLater/Core.py b/Biz/PodcastItLater/Core.py
index 42b336e..da1726c 100644
--- a/Biz/PodcastItLater/Core.py
+++ b/Biz/PodcastItLater/Core.py
@@ -545,15 +545,9 @@ class Database: # noqa: PLR0904
users_columns = [col[1] for col in users_info]
if "status" not in users_columns:
- # Add status column with default 'pending'
+ # Add status column with default 'active'
cursor.execute(
- "ALTER TABLE users ADD COLUMN status TEXT "
- "DEFAULT 'pending'",
- )
-
- # Set all existing users to 'active'
- cursor.execute(
- "UPDATE users SET status = 'active' WHERE status IS NULL",
+ "ALTER TABLE users ADD COLUMN status TEXT DEFAULT 'active'",
)
conn.commit()
@@ -629,12 +623,12 @@ class Database: # noqa: PLR0904
)
@staticmethod
- def create_user(email: str, status: str = "pending") -> tuple[int, str]:
+ def create_user(email: str, status: str = "active") -> tuple[int, str]:
"""Create a new user and return (user_id, token).
Args:
email: User email address
- status: Initial status (pending, active, or disabled)
+ status: Initial status (active or disabled)
Raises:
ValueError: If user ID cannot be retrieved after insert or if user
diff --git a/Biz/PodcastItLater/Web.py b/Biz/PodcastItLater/Web.py
index 6d3cf0a..82f8a10 100644
--- a/Biz/PodcastItLater/Web.py
+++ b/Biz/PodcastItLater/Web.py
@@ -1182,19 +1182,18 @@ def index(request: Request) -> HomePage:
def _handle_test_login(email: str, request: Request) -> Response:
"""Handle login in test mode."""
- # Special handling for demo account - auto-approve
+ # Special handling for demo account
is_demo_account = email == "demo@example.com"
user = Core.Database.get_user_by_email(email)
if not user:
- # Create new user with appropriate status
- status = "active" if is_demo_account else "pending"
- user_id, token = Core.Database.create_user(email, status=status)
+ # Create new user (defaults to active status)
+ user_id, token = Core.Database.create_user(email)
user = {
"id": user_id,
"email": email,
"token": token,
- "status": status,
+ "status": "active",
}
elif is_demo_account and user.get("status") != "active":
# Auto-activate demo account if it exists but isn't active