Skip to content

Commit

Permalink
fix(authentication): send the response properly
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Oct 8, 2023
1 parent 5f95c69 commit e2e98f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions app/Controllers/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ public function customLoginAction(): ResponseInterface {
$this->request = service("request");

if (!$this->hasCompatibleTokenExpirationType($this->request)) {
return $this->fail([
"errors" => [
[
"message" => "The client is not compatible with the server."
return $this->response
->setStatusCode(422)
->setJSON([
"errors" => [
[
"message" => "The client is not compatible with the server."
]
]
]
], 422);
]);
}

$original_response = $this->loginAction();
Expand Down
14 changes: 8 additions & 6 deletions app/Controllers/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ public function customRegisterAction(): ResponseInterface {
$this->request = service("request");

if (!$this->hasCompatibleTokenExpirationType($this->request)) {
return $this->fail([
"errors" => [
[
"message" => "The client is not compatible with the server."
return $this->response
->setStatusCode(422)
->setJSON([
"errors" => [
[
"message" => "The client is not compatible with the server."
]
]
]
], 422);
]);
}

$original_response = parent::registerAction();
Expand Down

0 comments on commit e2e98f1

Please sign in to comment.