前台登陆逻辑修改,请帮我实现“单设备登录(同端互斥)”功能

This commit is contained in:
2026-08-13 09:37:39 +08:00
parent f38f9b09ab
commit 58e061c9e7
8 changed files with 116 additions and 11 deletions
+5
View File
@@ -44,6 +44,11 @@ class User(Base, TimestampMixin):
Integer, default=50, server_default="50", nullable=False
)
# Token 版本号 — 每次登录/退出时递增,用于实现单设备登录(全局互斥)
token_version: Mapped[int] = mapped_column(
Integer, default=0, server_default="0", nullable=False
)
@property
def must_set_password(self) -> bool:
return self.user_type == "frontend" and not self.hashed_password