diff --git a/inc/HTTPAuthSession.php b/inc/HTTPAuthSession.php index e31b2a9d..c2768b55 100644 --- a/inc/HTTPAuthSession.php +++ b/inc/HTTPAuthSession.php @@ -368,11 +368,14 @@ class HTTPAuthSession { * - Configuration data will be in $c->authenticate_hook['config'], which might be an array, or whatever is needed. */ $principal = call_user_func( $c->authenticate_hook['call'], $username, $password ); + if ( $principal !== false && !($principal instanceof Principal) ) { + $principal = new Principal('username', $username); + } + if ( $principal === false ) { $this->SetCache($username, $password, 'fail'); - } else if (!($principal instanceof Principal) ) { + } else { $this->SetCache($username, $password, 'pass'); - $principal = new Principal('username', $username); } return $principal;