Thank you for quick reply.
I think that "ready" hook is triggered only if the user is logged in, so you can't use it to check if the user is not logged in. But it pointed me to right direction i believe.
Now I use the "startup" hook for disabling the login form:
public function startup($args)
{
(...)
if (($task == "login" && $action != "login") || $task == "logout")
{
header("HTTP/1.1 403");
exit;
}
}
and the "auth" hook for custom login processing:
public function auth($args)
{
(..)
$auth_token=$_REQUEST[custom_authtoken'];
(..)
return array(
"user" => "xxxx",
"pass" => "yyyy",
}
Everything is working fine, except that i can't figure out how to disable the login page after logging out. I tried to use the "logout_after" hook but with no luck, even if I use it in the simplest way, it does nothing (i.e. I end up on login page with URL
https://example.com/?_task=logout&_token=xxx)
public function init()
{
(..)
$this->add_hook('logout_after', array($this, 'logout_after'));
}
public function logout_after($args)
{
exit;
}
or like this (inspired by
https://github.com/marneu/logout_redirect/blob/master/logout_redirect.php):
public function logout_after($args)
{
header("Location https://example.com", true, 307);
exit;
}