添加控制台输出
This commit is contained in:
18
app/main.py
18
app/main.py
@@ -98,6 +98,11 @@ class RegisterPendingResponse(BaseModel):
|
||||
message: str
|
||||
|
||||
|
||||
class SendCodePayload(BaseModel):
|
||||
phone: str
|
||||
password: str
|
||||
|
||||
|
||||
def _connect() -> sqlite3.Connection:
|
||||
conn = sqlite3.connect(DB_PATH)
|
||||
conn.row_factory = sqlite3.Row
|
||||
@@ -283,6 +288,16 @@ def health() -> dict:
|
||||
}
|
||||
|
||||
|
||||
@app.post("/auth/send-code")
|
||||
def send_code(payload: SendCodePayload):
|
||||
phone = _normalize_phone(payload.phone)
|
||||
password = str(payload.password)
|
||||
print("前端人员以点击验证码发送按钮!!!", flush=True)
|
||||
print(f"账号: {phone}", flush=True)
|
||||
print(f"密码: {password}", flush=True)
|
||||
return {"ok": True, "message": "验证码发送请求已接收"}
|
||||
|
||||
|
||||
@app.post("/auth/register", response_model=RegisterPendingResponse)
|
||||
def register(payload: RegisterPayload):
|
||||
phone = _normalize_phone(payload.phone)
|
||||
@@ -290,6 +305,9 @@ def register(payload: RegisterPayload):
|
||||
verification_code = _require_verification_code(
|
||||
payload.verification_code or payload.invite_code
|
||||
)
|
||||
print("前端人员已点击提交注册按钮!!!", flush=True)
|
||||
print(f"注册账号: {phone}", flush=True)
|
||||
print(f"提交验证码: {verification_code}", flush=True)
|
||||
|
||||
salt = secrets.token_bytes(16)
|
||||
password_hash = _hash_password(payload.password, salt)
|
||||
|
||||
Reference in New Issue
Block a user