Files
wizarr/app/forms/api_keys.py
Matthieu B 1723e876b6 Refactor API models and invitation flow; add comprehensive tests
- Updated `InvitationCreateRequest` model to change `server_ids` from required to optional with improved description.
- Enhanced `library_model` to include `external_id`, `server_name`, and `enabled` fields.
- Modified `InvitationFlowManager` to prioritize new many-to-many relationship checks for invitations.
- Created a new migration file to merge branches related to API key and foreign key improvements.
- Added comprehensive tests for API endpoints, including status, users, invitations, libraries, servers, and API key management.
- Implemented error handling tests for malformed JSON and inactive API keys.
2025-08-13 20:58:11 +02:00

18 lines
532 B
Python

from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, Length
class ApiKeyCreateForm(FlaskForm):
"""Form for creating a new API key."""
name = StringField(
"Key Name",
validators=[
DataRequired(),
Length(min=1, max=100, message="Name must be between 1 and 100 characters"),
],
render_kw={"placeholder": "Enter a descriptive name for this API key"},
)
submit = SubmitField("Create API Key")