-
Notifications
You must be signed in to change notification settings - Fork 144
Closed
Labels
bugSomething isn't workingSomething isn't workingwaiting for infoIssues or pull requests that need further clarification from the authorIssues or pull requests that need further clarification from the author
Description
PHP Version
8
CodeIgniter4 Version
4.3.0
Shield Version
dev-develop
Which operating systems have you tested for this bug?
macOS
Which server did you use?
apache
Database
MariaDB
Did you customize Shield?
protected function buildUserFromRequest(): User
{
$fields = $this->prepareValidFields();
$request = service('request');
$data = $request->getJSON() ? (array) $request->getJSON() : $request->getPost($fields);
return new User($data);
}What happened?
buildUserFromRequest support only form data inputs, not json input from service("request").
Before:
$data = $request->getPost($fields);After:
$data = $request->getJSON() ? (array) $request->getJSON() : $request->getPost($fields);Steps to Reproduce
$this->validation->setRules([
"email" => ["label" => "Email", "rules" => "required|max_length[254]|valid_email"],
"newPassword" => ["label" => "New password", "rules" => "required|strong_password"],
"newPasswordAgain" => ["label" => "Repeat password", "rules" => "required|matches[newPassword]"],
]);it was catched when "strong_password" rule was applied.
Expected Output
/**
* Builds a new user instance from the global request.
*/
protected function buildUserFromRequest(): User
{
$fields = $this->prepareValidFields();
/** @var IncomingRequest $request */
$request = service('request');
$data = $request->getJSON() ? (array) $request->getJSON() : $request->getPost($fields);
return new User($data);
}Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingwaiting for infoIssues or pull requests that need further clarification from the authorIssues or pull requests that need further clarification from the author