fix: Allow email addresses as Nextcloud admin username
The validation was too restrictive, only allowing alphanumeric usernames. Now accepts both: - Standard usernames (letters, numbers, underscores) - Valid email addresses 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
0869787755
commit
d85ab9c493
|
|
@ -15,7 +15,11 @@
|
||||||
"Bash(python:*)",
|
"Bash(python:*)",
|
||||||
"Bash(git init:*)",
|
"Bash(git init:*)",
|
||||||
"Bash(git remote add:*)",
|
"Bash(git remote add:*)",
|
||||||
"Bash(git add:*)"
|
"Bash(git add:*)",
|
||||||
|
"Bash(git commit -m \"$(cat <<''EOF''\nInitial commit: LetsBe Cloud Orchestrator\n\nFeatures:\n- FastAPI backend with SQLAlchemy 2.0 async ORM\n- Tenant management (CRUD operations)\n- Task management with types: FILE_WRITE, ENV_UPDATE, DOCKER_RELOAD, COMPOSITE\n- Agent registration, heartbeat, and task claiming (/tasks/next)\n- Chatwoot deployment playbook (COMPOSITE task with ENV_UPDATE + DOCKER_RELOAD)\n- Alembic migrations for Postgres\n- Docker Compose setup for local development\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")",
|
||||||
|
"Bash(git push:*)",
|
||||||
|
"Bash(git remote set-url:*)",
|
||||||
|
"Bash(git commit:*)"
|
||||||
],
|
],
|
||||||
"deny": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,12 @@ class NextcloudInitialSetupRequest(BaseModel):
|
||||||
@field_validator("admin_username")
|
@field_validator("admin_username")
|
||||||
@classmethod
|
@classmethod
|
||||||
def validate_username(cls, v: str) -> str:
|
def validate_username(cls, v: str) -> str:
|
||||||
"""Validate that username is alphanumeric (with underscores allowed)."""
|
"""Validate that username is alphanumeric or a valid email address."""
|
||||||
if not re.match(r"^[a-zA-Z][a-zA-Z0-9_]*$", v):
|
username_pattern = r"^[a-zA-Z][a-zA-Z0-9_]*$"
|
||||||
|
email_pattern = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
|
||||||
|
if not (re.match(username_pattern, v) or re.match(email_pattern, v)):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Username must start with a letter and contain only letters, numbers, and underscores"
|
"Username must be alphanumeric (starting with a letter) or a valid email address"
|
||||||
)
|
)
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue