feat(security): 优化登录与支付密码错误提示文案并完善双端安全中心交互

- 安全校验提示:优化 AccountSecurity 与 MasterSecurity 密码错误提示,区分登录密码与支付密码,并增加剩余可重试次数提示
- 接口响应对齐:优化 Auth、MasterAuth、Security、Sms 控制器在短信验证码发送与密码校验时的异常处理与返回格式
- 腾讯云短信SDK:优化 SmsSingleSender::sendWithParam 方法入参默认值
- 双端小程序:优化用户端与师傅端登录页及账号安全中心的密码修改与找回交互逻辑
这个提交包含在:
2026-11-26 17:29:23 +08:00
父节点 c664d0a5de
当前提交 894da56623
共有 14 个文件被更改,包括 1090 次插入 和 624 次删除

查看文件

@@ -56,9 +56,13 @@ class MasterAuth extends MasterBase
$this->error('该师傅账号尚未设置登录密码,请使用微信一键登录后在账号安全中设置密码');
}
try {
MasterSecurity::verify((int)$master['id'], 'login', $password);
MasterSecurity::verify((int)$master['id'], 'login', $password, '登录密码');
} catch (\Throwable $e) {
$this->error($e->getMessage() === '密码不正确' ? '手机号或密码不正确' : $e->getMessage());
$msg = $e->getMessage();
if (strpos($msg, '不正确') !== false) {
$msg = str_replace('登录密码不正确', '手机号或密码不正确', $msg);
}
$this->error($msg);
}
if (!$this->masterAuth->direct((int)$master['id'])) {
$this->error($this->masterAuth->getError() ?: '登录失败');
@@ -199,12 +203,13 @@ class MasterAuth extends MasterBase
try {
$res = SmsService::sendVerifyCode($mobile, 'master_resetpwd', $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),
]));
}
/**
@@ -288,12 +293,13 @@ class MasterAuth extends MasterBase
try {
$res = SmsService::sendVerifyCode($mobile, 'master_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),
]));
}
/**
@@ -322,9 +328,13 @@ class MasterAuth extends MasterBase
$ignoreOld = true;
} else {
try {
MasterSecurity::verify($mid, 'login', $old);
MasterSecurity::verify($mid, 'login', $old, '原登录密码');
} catch (\Throwable $e) {
$this->error($e->getMessage());
$msg = $e->getMessage();
if (strpos($msg, '15分钟') !== false) {
$msg .= ',或点击下方改用短信验证码';
}
$this->error($msg);
}
$ignoreOld = false;
}
@@ -384,12 +394,13 @@ class MasterAuth extends MasterBase
try {
$res = SmsService::sendVerifyCode($mobile, 'master_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),
]));
}
/**
@@ -419,9 +430,13 @@ class MasterAuth extends MasterBase
}
} else {
try {
MasterSecurity::verify($mid, 'payment', (string)$this->request->post('old_password', ''));
MasterSecurity::verify($mid, 'payment', (string)$this->request->post('old_password', ''), '原支付密码');
} catch (\Throwable $e) {
$this->error($e->getMessage());
$msg = $e->getMessage();
if (strpos($msg, '15分钟') !== false) {
$msg .= ',或点击下方改用短信验证码';
}
$this->error($msg);
}
}
$updated = Db::name('master_security')