This commit is contained in:
Leon
2025-09-21 19:38:58 +02:00
parent a5d511eaf3
commit 429b9f256b
4 changed files with 11 additions and 4 deletions

View File

@@ -113,6 +113,9 @@ def create_or_update_settings(db: Session, settings: SettingsCreate):
db_settings.auth_password_hash = get_password_hash(value)
else:
db_settings.auth_password_hash = None
elif key == "imap_password":
if value: # Only update password if a new one is provided
setattr(db_settings, key, value)
elif hasattr(db_settings, key):
setattr(db_settings, key, value)

View File

@@ -19,7 +19,7 @@ class SettingsBase(BaseModel):
class SettingsCreate(SettingsBase):
"""Schema for creating or updating settings, including the IMAP password."""
imap_password: str
imap_password: str | None = None
auth_password: str | None = None