Coverage for seedboxsync/front/forms/settings/apikey.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.16.1, created at 2026-09-26 17:14 +0000

1# 

2# Copyright (C) 2015-2026 Guillaume Kulakowski <guillaume@kulakowski.fr> 

3# 

4# For the full copyright and license information, please view the LICENSE 

5# file that was distributed with this source code. 

6# 

7"""WTForms definitions for API key management.""" 

8 

9from flask_wtf import FlaskForm 

10from wtforms import StringField 

11from wtforms.validators import DataRequired, Length 

12from seedboxsync.front.babel import gettext as _ 

13 

14 

15class ApiKeyForm(FlaskForm): # type: ignore[misc] 

16 """ 

17 Form for creating a new API key. 

18 

19 Requires a descriptive name/label for identifying the key's usage context. 

20 """ 

21 

22 name = StringField(_("API key Name"), validators=[DataRequired(), Length(min=4, max=32)], render_kw={"placeholder": "homeassistant", "icon": "fa-key"})