| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- """Insert a SCAFFOLD longwu988 row for dev testing of B/C preconditions.
- WARNING: This row has a FAKE token + PLAINTEXT password.
- - Token is NOT valid for 996box (B1/B2/C1 will get 401).
- - Password IS the real one (from .env) so we can re-login when token
- expires. For dev only — production should encrypt the password.
- To get a REAL token: run A1 (manual geetest), which will overwrite
- this row's token via UserStore.upsert_by_username.
- """
- import sys
- from pathlib import Path
- _HERE = Path(__file__).resolve().parent
- sys.path.insert(0, str(_HERE.parent / "src"))
- from cq2_sdk.env_loader import load_env
- load_env(_HERE.parent / ".env")
- from cq2_sdk.store import UserStore, connection
- ACCOUNT = "longwu988"
- PASSWORD = "Longwu1988" # hardcoded for scaffold; real A1 reads from .env
- PHONE = "17756576757" # 用户的手机号 (A2 SMS 登录备用)
- FAKE_TOKEN = "DEV_SCAFFOLD_TOKEN_NOT_REAL_RUN_A1_TO_OVERWRITE_xxxxxxxxxxxxxxxxxxxx"
- with connection() as conn:
- users = UserStore(conn)
- u = users.upsert_by_username(
- username=ACCOUNT,
- token=FAKE_TOKEN,
- password=PASSWORD,
- phone=PHONE, # 一并写进 phone 字段
- token_expires_at=None,
- )
- print(f"[OK] upserted {ACCOUNT}: id={u.id}")
- print(f" username = {u.username}")
- print(f" phone = {u.phone}")
- print(f" password_hash = {u.password_hash}")
- print(f" token (60) = {u.token[:60]}")
- print()
- print("!!! WARNINGS !!!")
- print(" - token is FAKE — B1/B2/C1 will return 401 from 996box")
- print(" - password stored as PLAINTEXT — dev only, encrypt for prod")
- print(" - To get a real token: run A1 (will overwrite token, keep phone/password)")
|