feat: add user settings page (change username/password) and remove public registration

This commit is contained in:
earthjasonlin committed 2026-07-05 22:01:24 +08:00
1 parent fae5a05be1
commit c0130afe12
12 files changed
+127 -348

No files matched your search

+2 -19
View File
@@ -1,7 +1,6 @@
import uuid
from datetime import datetime, timezone
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, event
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.orm import relationship, validates
from app.database import Base
@@ -19,7 +18,6 @@ class User(Base):
password_hash = Column(String(128), nullable=False)
created_at = Column(DateTime, default=_utcnow)
api_keys = relationship("ApiKey", back_populates="user", cascade="all, delete-orphan")
profiles = relationship("Profile", back_populates="user", cascade="all, delete-orphan")
sessions = relationship("UserSession", back_populates="user", cascade="all, delete-orphan")
@@ -35,21 +33,6 @@ class UserSession(Base):
user = relationship("User", back_populates="sessions")
class ApiKey(Base):
__tablename__ = "api_keys"
id = Column(Integer, primary_key=True, index=True)
user_id = Column(Integer, ForeignKey("users.id", ondelete="CASCADE"), nullable=False)
key = Column(String(64), unique=True, nullable=False, index=True)
created_at = Column(DateTime, default=_utcnow)
user = relationship("User", back_populates="api_keys")
@staticmethod
def generate_key() -> str:
return uuid.uuid4().hex
class Profile(Base):
__tablename__ = "profiles"
@@ -68,7 +51,7 @@ class Postcard(Base):
id = Column(Integer, primary_key=True, index=True)
profile_id = Column(Integer, ForeignKey("profiles.id", ondelete="CASCADE"), nullable=False)
card_number = Column(String(64), nullable=False)
status = Column(String(16), nullable=False) # sent / delivered / received
status = Column(String(16), nullable=False)
# sent & delivered
recipient_name = Column(String(64))
country = Column(String(64))
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.