global $wgAuth;
if ( $wgAuth && !$wgAuth instanceof AuthManagerAuthPlugin ) {
- return call_user_func_array( [ $wgAuth, $method ], $params );
+ return $wgAuth->$method( ...$params );
} else {
return $return;
}
$status = self::SEC_FAIL;
}
- $this->logger->info( __METHOD__ . ": $operation is $status" );
+ $this->logger->info( __METHOD__ . ": $operation is $status for '{user}'",
+ [
+ 'user' => $session->getUser()->getName(),
+ 'clientip' => $this->getRequest()->getIP(),
+ ]
+ );
return $status;
}
* returned success.
*
* @param AuthenticationRequest $req
+ * @param bool $isAddition Set true if this represents an addition of
+ * credentials rather than a change. The main difference is that additions
+ * should not invalidate BotPasswords. If you're not sure, leave it false.
*/
- public function changeAuthenticationData( AuthenticationRequest $req ) {
+ public function changeAuthenticationData( AuthenticationRequest $req, $isAddition = false ) {
$this->logger->info( 'Changing authentication data for {user} class {what}', [
'user' => is_string( $req->username ) ? $req->username : '<no name>',
'what' => get_class( $req ),
// When the main account's authentication data is changed, invalidate
// all BotPasswords too.
- \BotPassword::invalidateAllPasswordsForUser( $req->username );
+ if ( !$isAddition ) {
+ \BotPassword::invalidateAllPasswordsForUser( $req->username );
+ }
}
/**@}*/
if ( $permErrors ) {
$status = Status::newGood();
foreach ( $permErrors as $args ) {
- call_user_func_array( [ $status, 'fatal' ], $args );
+ $status->fatal( ...$args );
}
return $status;
}
* Fetch authentication data from the current session
* @protected For use by AuthenticationProviders
* @param string $key
- * @param mixed $default
+ * @param mixed|null $default
* @return mixed
*/
public function getAuthenticationSessionData( $key, $default = null ) {
$providers += $this->getSecondaryAuthenticationProviders();
}
foreach ( $providers as $provider ) {
- call_user_func_array( [ $provider, $method ], $args );
+ $provider->$method( ...$args );
}
}