feat(security): 优化登录与支付密码错误提示文案并完善双端安全中心交互
- 安全校验提示:优化 AccountSecurity 与 MasterSecurity 密码错误提示,区分登录密码与支付密码,并增加剩余可重试次数提示 - 接口响应对齐:优化 Auth、MasterAuth、Security、Sms 控制器在短信验证码发送与密码校验时的异常处理与返回格式 - 腾讯云短信SDK:优化 SmsSingleSender::sendWithParam 方法入参默认值 - 双端小程序:优化用户端与师傅端登录页及账号安全中心的密码修改与找回交互逻辑
这个提交包含在:
@@ -44,12 +44,13 @@ class Security extends Base
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, 'user_changepwd', $this->request->ip());
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
}
|
||||
|
||||
public function changeLoginPassword()
|
||||
@@ -70,7 +71,15 @@ class Security extends Base
|
||||
}
|
||||
$ignoreOld = true;
|
||||
} else {
|
||||
try { AccountSecurity::verify($uid, 'login', $old); } catch (\Throwable $e) { $this->error($e->getMessage()); }
|
||||
try {
|
||||
AccountSecurity::verify($uid, 'login', $old, '原登录密码');
|
||||
} catch (\Throwable $e) {
|
||||
$msg = $e->getMessage();
|
||||
if (strpos($msg, '15分钟') !== false) {
|
||||
$msg .= ',或点击下方改用短信验证码';
|
||||
}
|
||||
$this->error($msg);
|
||||
}
|
||||
$ignoreOld = false;
|
||||
}
|
||||
} else {
|
||||
@@ -111,12 +120,13 @@ class Security extends Base
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, 'user_paypwd', $this->request->ip());
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
}
|
||||
|
||||
public function changePaymentPassword()
|
||||
@@ -139,8 +149,15 @@ class Security extends Base
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
try { AccountSecurity::verify($uid, 'payment', (string)$this->request->post('old_password', '')); }
|
||||
catch (\Throwable $e) { $this->error($e->getMessage()); }
|
||||
try {
|
||||
AccountSecurity::verify($uid, 'payment', (string)$this->request->post('old_password', ''), '原支付密码');
|
||||
} catch (\Throwable $e) {
|
||||
$msg = $e->getMessage();
|
||||
if (strpos($msg, '15分钟') !== false) {
|
||||
$msg .= ',或点击下方改用短信验证码';
|
||||
}
|
||||
$this->error($msg);
|
||||
}
|
||||
}
|
||||
$updated = Db::name('user_security')->where('user_id', $uid)->where('payment_password_hash', $oldHash)->update([
|
||||
'payment_password_hash' => password_hash($new, PASSWORD_DEFAULT),
|
||||
|
||||
在新工单中引用
屏蔽一个用户