aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/models.py
diff options
context:
space:
mode:
authorDennis Fink2026-08-16 20:39:41 +0200
committerDennis Fink2026-08-16 20:39:41 +0200
commit58a4a8ee06bcf23c3957af5c2ea035b6797c4395 (patch)
tree6aaeef166747520cac2c17ed47b0a7ffc9eebf12 /webmentions_ssg/models.py
parente0f65d7ff582b32f1c7b5508bba8cda807aaae5f (diff)
downloadwebmentions-ssg-58a4a8ee06bcf23c3957af5c2ea035b6797c4395.tar.gz
webmentions-ssg-58a4a8ee06bcf23c3957af5c2ea035b6797c4395.zip
refactor(core): remove user credential length limits
Store usernames and password hashes as text instead of fixed-length strings so their maximum length is not constrained by the database schema. Require every user to have a password hash.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/models.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/webmentions_ssg/models.py b/webmentions_ssg/models.py
index 02c42ef..b6679e8 100644
--- a/webmentions_ssg/models.py
+++ b/webmentions_ssg/models.py
@@ -3,7 +3,6 @@ from __future__ import annotations
import uuid
from datetime import datetime, timezone
from enum import StrEnum
-from typing import Optional
from flask_login import UserMixin
from sqlalchemy import (
@@ -33,8 +32,8 @@ class User(UserMixin, Base):
__tablename__ = "users"
id: Mapped[int] = mapped_column(primary_key=True)
- username: Mapped[str] = mapped_column(String(64), index=True, unique=True)
- password_hash: Mapped[Optional[str]] = mapped_column(String(256))
+ username: Mapped[str] = mapped_column(Text(), index=True, unique=True)
+ password_hash: Mapped[str] = mapped_column(Text(), nullable=False)
def __repr__(self) -> str:
return f"<User {self.username}>"