-
PHP Version7.4.30 CodeIgniter4 Version4.2.3 Shield Versiondevelop Which operating systems have you tested for this bug?Windows Which server did you use?apache DatabaseMySQL 5.7.36 Did you customize Shield?
What happened?I filled in the form with password and confirm password and validation failed. Steps to Reproducepublic function resetAction()
{
$rules = [
'password' => [
'required',
'strong_password'
],
'password_confirm' => [
'required',
'matches[password]',
],
];
if (!$this->validate($rules)) {
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
}
{...}
} Expected OutputAnything else?No response |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
I think Shied does not provide Rest Password page. |
Beta Was this translation helpful? Give feedback.
-
Hey @jlopes90 , Thanks for your report, Do you agree with me to move this topic to the discussion section? |
Beta Was this translation helpful? Give feedback.
-
yes |
Beta Was this translation helpful? Give feedback.
-
Because |
Beta Was this translation helpful? Give feedback.
-
The fields return shield/src/Authentication/Passwords/ValidationRules.php Lines 56 to 69 in a76b35e protected function buildUserFromRequest(): User
{
$fields = $this->prepareValidFields();
/** @var IncomingRequest $request */
$request = service('request');
$data = $request->getPost($fields);
if (empty($data['username'])){
unset($data['username']);
}
if (empty($data['email'])){
unset($data['email']);
}
return new User($data);
} Forces to validate email is empty string, the result gives an error, I used to check if email is empty, just ignore it. shield/src/Authentication/Passwords/NothingPersonalValidator.php Lines 68 to 87 in a76b35e // Parse out as many pieces as possible from username, password and email.
// Use the pieces as needles and haystacks and look every which way for matches.
if ($valid) {
// Take username apart for use as search needles
$needles = $this->strip_explode($userName);
// If you don't use email
if (!empty($email)) {
// extract local-part and domain parts from email as separate needles
[
$localPart,
$domain,
] = explode('@', $email);
// might be [email protected] and we want all the needles we can get
$emailParts = $this->strip_explode($localPart);
if (!empty($domain)) {
$emailParts[] = $domain;
}
$needles = array_merge($needles, $emailParts);
}
// Get any other "personal" fields defined in config
$personalFields = $this->config->personalFields;
{...}
} I edited it but I know it's not a good idea. |
Beta Was this translation helpful? Give feedback.
-
Add email address to the data to validate. |
Beta Was this translation helpful? Give feedback.
-
I did like this:
|
Beta Was this translation helpful? Give feedback.
I did like this:
.../reset?email=xxx&token=xxx
.