main.py: password_set 迁移语句改为内联字面量(消除变量间接传参,安全复查整改)
This commit is contained in:
+1
-2
@@ -565,8 +565,7 @@ async def _migrate_legacy(conn) -> None:
|
|||||||
if "password_set" not in users_cols:
|
if "password_set" not in users_cols:
|
||||||
# 老库的 password_hash 是注册时的随机占位值(用户本人不知道),
|
# 老库的 password_hash 是注册时的随机占位值(用户本人不知道),
|
||||||
# 因此统一视为未设置密码,用户下次验证码登录时会被引导设置。
|
# 因此统一视为未设置密码,用户下次验证码登录时会被引导设置。
|
||||||
add_column_sql = "ALTER TABLE users ADD COLUMN password_set INTEGER NOT NULL DEFAULT 0"
|
await conn.execute(text("ALTER TABLE users ADD COLUMN password_set INTEGER NOT NULL DEFAULT 0"))
|
||||||
await conn.execute(text(add_column_sql))
|
|
||||||
for index in users.indexes:
|
for index in users.indexes:
|
||||||
if index.name in ("uq_users_email", "uq_users_phone"):
|
if index.name in ("uq_users_email", "uq_users_phone"):
|
||||||
await conn.execute(CreateIndex(index, if_not_exists=True))
|
await conn.execute(CreateIndex(index, if_not_exists=True))
|
||||||
|
|||||||
Reference in New Issue
Block a user