deal with phpstan warnings related to base authentication modules
This commit is contained in:
parent
5a50c333b2
commit
81a10f69bc
|
@ -8,7 +8,6 @@ abstract class Auth_Base extends Plugin implements IAuthModule {
|
||||||
$this->pdo = Db::pdo();
|
$this->pdo = Db::pdo();
|
||||||
}
|
}
|
||||||
|
|
||||||
// compatibility wrapper, because of how pluginhost works (hook name == method name)
|
|
||||||
function hook_auth_user(...$args) {
|
function hook_auth_user(...$args) {
|
||||||
return $this->authenticate(...$args);
|
return $this->authenticate(...$args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
interface IAuthModule {
|
interface IAuthModule {
|
||||||
|
/**
|
||||||
|
* @param string $login
|
||||||
|
* @param string $password
|
||||||
|
* optional third string $service
|
||||||
|
* @return int|false user_id
|
||||||
|
*/
|
||||||
function authenticate($login, $password); // + optional third parameter: $service
|
function authenticate($login, $password); // + optional third parameter: $service
|
||||||
function hook_auth_user(...$args); // compatibility wrapper due to how hooks work
|
|
||||||
|
/** this is a pluginhost compatibility wrapper that invokes $this->authenticate(...$args) (Auth_Base)
|
||||||
|
* @param mixed $args = ($login, $password, $service)
|
||||||
|
* @return int|false user_id
|
||||||
|
*/
|
||||||
|
function hook_auth_user(...$args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,8 +141,24 @@ abstract class Plugin {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_auth_user($login, $password, $service) {
|
/** this is a pluginhost compatibility wrapper that invokes $this->authenticate(...$args) (Auth_Base)
|
||||||
|
* @param mixed $args = ($login, $password, $service)
|
||||||
|
* @return int|false user_id
|
||||||
|
*/
|
||||||
|
function hook_auth_user(...$args) {
|
||||||
user_error("Dummy method invoked.", E_USER_ERROR);
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** IAuthModule only
|
||||||
|
* @param string $login
|
||||||
|
* @param string $password
|
||||||
|
* optional third string $service
|
||||||
|
* @return int|false user_id
|
||||||
|
*/
|
||||||
|
function authenticate($login, $password) {
|
||||||
|
user_error("Dummy method invoked.", E_USER_ERROR);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_hotkey_map($hotkeys) {
|
function hook_hotkey_map($hotkeys) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Auth_Internal extends Auth_Base {
|
||||||
$host->add_hook($host::HOOK_AUTH_USER, $this);
|
$host->add_hook($host::HOOK_AUTH_USER, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param string $service */
|
||||||
function authenticate($login, $password, $service = '') {
|
function authenticate($login, $password, $service = '') {
|
||||||
|
|
||||||
$otp = (int) ($_REQUEST["otp"] ?? 0);
|
$otp = (int) ($_REQUEST["otp"] ?? 0);
|
||||||
|
|
Loading…
Reference in New Issue