代码功能更新

This commit is contained in:
root
2025-05-18 07:42:27 +00:00
parent 7fc1d422a1
commit 4a90c41da2
2083 changed files with 695218 additions and 3 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace app\validate\api\member;
//邮箱密码登录验证器
use app\model\Member;
use laytp\library\Str;
use think\Validate;
class EmailLogin extends Validate
{
//数组顺序就是检测的顺序,比如这里,会先检测code验证码的正确性
protected $rule = [
'email' => 'require|email',
'password' => 'require|length:6,26|checkPassword:',
];
//定义内置方法检验失败后返回的字符
protected $message = [
'email.require' => '邮箱不能为空',
'email.email' => '邮箱格式不正确',
'password.require' => '密码不能为空',
'password.length' => '密码长度需要6到26个字符',
];
//自定义密码检验方法
protected function checkPassword($password, $rule, $data)
{
$email = $data['email'];
$user = new Member();
$passwordHash = $user->getFieldByEmail($email, 'password');
return (!Str::checkPassword($password, $passwordHash)) ? '账户信息错误' : true;
}
}