因此,当与codeigniter集成时,myth auth中似乎存在一个错误。
即使$email
为空,它也会尝试对$password
进行身份验证。因此抛出Undefined offset: 1
异常。
此处为91 线上的APPPATHThirdPartymyth-authsrcAuthenticationPasswordsNothingPersonalValidator.php
84 // Use the pieces as needles and haystacks and look every which way for matches.
85 if($valid)
86 {
87 // Take username apart for use as search needles
88 $needles = $this->strip_explode($userName);
89
90 // extract local-part and domain parts from email as separate needles
91**** [$localPart, $domain] = explode('@', $email);
92 // might be john.doe@example.com and we want all the needles we can get
93 $emailParts = $this->strip_explode($localPart);
94 if( ! empty($domain))
95 {
96 $emailParts[] = $domain;
97 }
98 $needles = array_merge($needles, $emailParts);
每当电子邮件字段为空时,总是抛出该异常,而不是使用重定向回
"邮件为空">
错误消息
所以,现在我正在使用一个非常糟糕的破解并在myth-authsrcAuthController
第180行编辑系统文件…
$rules_part1 = [
'username' => 'required|alpha_numeric_space|min_length[3]|is_unique[users.username]',
'email' => 'required|valid_email|is_unique[users.email]',
];
if (! $this->validate($rules_part1))
{
return redirect()->back()->withInput()->with('errors', service('validation')->getErrors());
}
$rules_part2 = [
'password' => 'required|strong_password',
'pass_confirm' => 'required|matches[password]',
];
if (! $this->validate($rules_part2))
{
return redirect()->back()->withInput()->with('errors', service('validation')->getErrors());
}