添加LOTTERY_E2E环境变量来控制E2E测试相关功能, 包括绕过验证码、登录限制和钱包API URL验证, 同时更新composer.json以包含E2E专用的提供者和服务。
This commit is contained in:
@@ -50,6 +50,17 @@ final class AdminCaptchaService
|
||||
|
||||
public function verify(?string $captchaKey, ?string $captchaInput, string $scope = self::SCOPE_ADMIN): bool
|
||||
{
|
||||
// E2E 旁路:仅在 LOTTERY_E2E=true 时放行,约定 captcha_code == LOTTERY_E2E_BYPASS
|
||||
// 视为通过。生产环境不启用,对应变量在 .env.example 留空。
|
||||
if ($captchaInput !== null && trim($captchaInput) === 'LOTTERY_E2E_BYPASS'
|
||||
&& (bool) env('LOTTERY_E2E', false)) {
|
||||
// 顺便消费掉 key,避免同一 key 被多次复用
|
||||
if ($captchaKey !== null && $captchaKey !== '') {
|
||||
Cache::pull($this->prefix($scope).$captchaKey);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($captchaKey === null || $captchaKey === ''
|
||||
|| $captchaInput === null || trim($captchaInput) === '') {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user