I have an auth (login) controller.
When I login, if the login validation succeeds, you are redirected to the home page, otherwise an error is shown and you stay on the login page with a flash message. (that's supossed to happen).
The login screen was displayed just fine but after logging (failed), I just go a blank page.
Here’s how my login controller:
PHP Code:
public function auth(string $callbox, string $user, string $password)
{
try {
$client = Services::curlrequest();
$body = [
'usuario' => $user,
'senha' => $password
];
$request = $client->post("$callbox/webservice/v2.0/auth", [
'json' => $body
]);
$response = json_decode($request->getBody());
if ($response->code == 200) {
dd($response);
} else {
$session = session();
$session->setFlashdata('message', $response->message);
return redirect()->back()->withInput();
}
} catch (\Exception $e) {
$session = session();
$session->setFlashdata('message', 'Verifique se a URL do callbox está correta');
throw new \CodeIgniter\Router\Exceptions\RedirectException('zoho');
}
}
How can I solve this?