From 7dec6515480217c76d0494f5fa8062a4d3ad0e6e Mon Sep 17 00:00:00 2001 From: koogua Date: Sat, 27 Feb 2021 14:59:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=95=8F=E6=84=9F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=87=E6=BB=A4=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Setting.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Admin/Services/Setting.php b/app/Http/Admin/Services/Setting.php index 35ff796c..b2787a43 100644 --- a/app/Http/Admin/Services/Setting.php +++ b/app/Http/Admin/Services/Setting.php @@ -121,11 +121,13 @@ class Setting extends Service * demo分支过滤敏感数据 */ if ($items->count() > 0) { + $pattern = '/(id|auth|key|secret|token|password|pwd|mobile|phone|mail|email)/'; + $controllerName = $this->dispatcher->getControllerName(); foreach ($items as $item) { - $case1 = preg_match('/(id|auth|key|secret|token|password|pwd)$/', $item->item_key); - $case2 = $this->dispatcher->getControllerName() == 'setting'; + $case1 = preg_match($pattern, $item->item_key); + $case2 = $controllerName == 'setting'; if ($case1 && $case2) { - $item->item_value = '***'; + $item->item_value = '******'; } $result[$item->item_key] = $item->item_value; }