default user
This commit is contained in:
1 parent
8955c58d19
commit
b15d097b9c
5 files changed
+175
-62
No files matched your search
@@ -17,15 +17,16 @@ async def create_admin():
|
||||
existing_user = result.scalar_one_or_none()
|
||||
|
||||
if existing_user:
|
||||
print(f"用户 linkong 已存在,更新密码...")
|
||||
existing_user.set_password("LK12345678")
|
||||
print("用户 linkong 已存在,更新密码...")
|
||||
existing_user.set_password("12345678")
|
||||
existing_user.role = "super_admin"
|
||||
existing_user.email = "linkong@planet.local"
|
||||
else:
|
||||
print("创建管理员用户...")
|
||||
user = User(
|
||||
username="linkong",
|
||||
email="linkong@example.com",
|
||||
password_hash=get_password_hash("LK12345678"),
|
||||
email="linkong@planet.local",
|
||||
password_hash=get_password_hash("12345678"),
|
||||
role="super_admin",
|
||||
is_active=True,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user