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

14 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"""SeedboxSync WTForms form for authentication settings.""" 

8 

9from flask_wtf import FlaskForm 

10from wtforms import BooleanField, StringField, URLField 

11from wtforms.validators import Length 

12from seedboxsync.front.babel import gettext as _ 

13 

14 

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

16 """ 

17 Form for configuring authentication settings. 

18 

19 Provides administrative controls for enabling or disabling global 

20 user authentication within the application. 

21 """ 

22 

23 login_disabled = BooleanField(_("Disable authentication fully?")) 

24 auth_gravatar_enabled = BooleanField(_("Enable Gravatar for users?")) 

25 

26 # OAuth2 / OIDC 

27 oauth_enabled = BooleanField(_("Enable OAuth2 / OIDC for the authentication?")) 

28 oauth_auto_create_user_enabled = BooleanField(_("Auto-create users?")) 

29 oauth_builtin_authentication_disabled = BooleanField(_("Disable built-in authentication?")) 

30 oauth_name = StringField(_("OAuth Client Name"), validators=[Length(min=4, max=32)], render_kw={"placeholder": "oidc", "icon": "fa-tag"}) 

31 oauth_client_id = StringField(_("OAuth Client ID"), render_kw={"placeholder": "fddd434e-fc50-42ec-9b97-69517a7412fc", "icon": "fa-id-badge"}) 

32 oauth_client_secret = StringField(_("OAuth Client Secret"), render_kw={"placeholder": "05e20c6e-2c69-4501-919f-4f44be05ac0b", "icon": "fa-key"}) 

33 oauth_server_metadata_url = URLField(_("OIDC Server Metadata URL"), render_kw={"placeholder": "05e20c6e-2c69-4501-919f-4f44be05ac0b", "icon": "fa-link"})