Users Verify
Legacy umbrella endpoint:
POST /users/verify/{type}/{action}.json實際 routing key 要分開調查與搬移,不把 phone/preauth、phone/auth、voice/preauth 混成一支 generic verify API。
Routing Key Index
| API | Legacy | New | 狀態 |
|---|---|---|---|
POST /users/verify/phone/preauth.json | UsersController::verify('phone', 'preauth') | phone/preauth | 已補;new staging Infobip delivery 已驗證 |
POST /users/verify/phone/auth.json | UsersController::verify('phone', 'auth') | phone/auth | 已補;new staging logged-in auth / ownership reset 已驗證 |
POST /users/verify/voice/preauth.json | UsersController::verify('voice', 'preauth') | voice/preauth | 已補;真實 voice provider 實測待補 |
POST /users/verify/email/preauth.json | 同一 umbrella action | new web caller 已改走 EmailVerifications::preauth*() | legacy 只見 2 筆,先確認 replacement,不列第一批 |
Legacy controller 主流程:/Users/mattsu/Documents/Site/get-lancer-php56/app/Controller/UsersController.php:5804-6044。
正式機 log 位置、rotation 命名、可重複使用的查詢語法與本次流量結果,統一記錄在 migration 共用的 _meta/access_log.md。
搬移前固定檢查
preauth與auth是同一條 OTP lifecycle,hash、OTP、log 與重複限制要一起對表。- session 是 optional;有 valid session 時會補
user_id/ user email,不能自行改成強制登入。 - 需追
PhoneVerification、PhoneVerificationLog、PhoneDelivery、BlockedPhoneDeviceId、LimitIpUtil、PhoneUtilFactory、SMS / voice provider、referral 與AbnormalConfigside effect。 - new 已有部分同名 model / util,但都是 shared method;使用前先查 caller,差異用 wrapper / option / 專用 method 處理。
area遵守 repo 特例:台灣環境不可補area=tw。- 每個 routing key 各自建立 detail doc;本頁只維護索引與跨路徑結論。
2026-07-16 實作與驗證結果
- new action:
Endpoint/V1/Users.php:1125-1407。 - explicit routing:
Lib/Common/RouterRule/Mapping.php:108-111。 - OTP model:
Lib/Model/PhoneVerification.php:27-134。 - verify delivery wrapper:
Lib/Model/PhoneDelivery.php:27-45。 - verified phone ownership / notification:
Lib/Model/User.php:718-848。 - PHPUnit:
tests/UsersVerifyTest.php,9 tests / 85 assertions。 - 已測既有案例、TW/HK/SG delivery MSISDN 與 legacy IP-limit 403 response;每個案例用 DB transaction rollback,避免清除 concurrent staging rows。
- new staging 已驗證 Infobip SMS、delivery callback、logged-in auth 與 phone ownership reset;voice provider、referral / wallet、worker downstream 與完整 legacy/new diff 待補。