Update for MW 1.42.0

master
落雨楓 1 month ago
parent ec85da6f9a
commit 5b1e46a762

@ -8,7 +8,7 @@
"license-name": "MIT", "license-name": "MIT",
"type": "other", "type": "other",
"requires": { "requires": {
"MediaWiki": ">= 1.35.0" "MediaWiki": ">= 1.40.0"
}, },
"MessagesDirs": { "MessagesDirs": {
"IsekaiOIDC": [ "IsekaiOIDC": [

@ -2,13 +2,9 @@
namespace Isekai\OIDC; namespace Isekai\OIDC;
use ApiBase;
use ApiQueryBase; use ApiQueryBase;
use Exception;
use Exif;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use Wikimedia\ParamValidator\ParamValidator; use Wikimedia\ParamValidator\ParamValidator;
use User;
class ApiOIDCAvatar extends ApiQueryBase { class ApiOIDCAvatar extends ApiQueryBase {
public function __construct( $main, $method ) { public function __construct( $main, $method ) {

@ -9,12 +9,13 @@ use MediaWiki\Auth\AuthenticationResponse;
use MediaWiki\Auth\AuthManager; use MediaWiki\Auth\AuthManager;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use MediaWiki\Session\SessionManager; use MediaWiki\Session\SessionManager;
use MediaWiki\User\User;
use MediaWiki\Title\Title;
use MediaWiki\SpecialPage\SpecialPage;
use MediaWiki\Parser\Sanitizer;
use MediaWiki\Context\RequestContext;
use MediaWiki\Message\Message;
use StatusValue; use StatusValue;
use User;
use Title;
use SpecialPage;
use Sanitizer;
use RequestContext;
class IsekaiOIDCAuth extends AbstractPrimaryAuthenticationProvider { class IsekaiOIDCAuth extends AbstractPrimaryAuthenticationProvider {
@ -164,7 +165,8 @@ class IsekaiOIDCAuth extends AbstractPrimaryAuthenticationProvider {
$authManager->setAuthenticationSessionData(self::USERNAME_SESSION_KEY, $username); $authManager->setAuthenticationSessionData(self::USERNAME_SESSION_KEY, $username);
return AuthenticationResponse::newPass($username); return AuthenticationResponse::newPass($username);
} else { } else {
return AuthenticationResponse::newFail(wfMessage('isekaioidc-login-failed')); $message = Message::newFromSpecifier('isekaioidc-login-failed');
return AuthenticationResponse::newFail($message);
} }
} }
@ -580,7 +582,6 @@ class IsekaiOIDCAuth extends AbstractPrimaryAuthenticationProvider {
$userIdentityLookup = MediaWikiServices::getInstance()->getUserIdentityLookup(); $userIdentityLookup = MediaWikiServices::getInstance()->getUserIdentityLookup();
$userIdentity = $userIdentityLookup->getUserIdentityByName( $preferred_username ); $userIdentity = $userIdentityLookup->getUserIdentityByName( $preferred_username );
if ( !$userIdentity || !$userIdentity->isRegistered() ) { if ( !$userIdentity || !$userIdentity->isRegistered() ) {
return $preferred_username; return $preferred_username;
} }

@ -1,11 +1,12 @@
<?php <?php
namespace Isekai\OIDC; namespace Isekai\OIDC;
use Html;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use OutputPage; use MediaWiki\Html\Html;
use RequestContext; use MediaWiki\Output\OutputPage;
use Title; use MediaWiki\Context\RequestContext;
use MediaWiki\Title\Title;
use MediaWiki\User\User;
class IsekaiOIDCAuthHooks { class IsekaiOIDCAuthHooks {
const SYNLOGIN_SESSIONKEY = 'IsekaiOIDCSyncLogin'; const SYNLOGIN_SESSIONKEY = 'IsekaiOIDCSyncLogin';
@ -97,7 +98,7 @@ class IsekaiOIDCAuthHooks {
$request->response()->setCookie(self::SYNLOGOUT_SESSIONKEY, 1); $request->response()->setCookie(self::SYNLOGOUT_SESSIONKEY, 1);
} }
public static function onGetPreferences(\User $user, &$preferences) { public static function onGetPreferences(User $user, &$preferences) {
$services = MediaWikiServices::getInstance(); $services = MediaWikiServices::getInstance();
$wgIsekaiOIDC = $services->getMainConfig()->get('IsekaiOIDC'); $wgIsekaiOIDC = $services->getMainConfig()->get('IsekaiOIDC');

@ -3,7 +3,7 @@ namespace Isekai\OIDC;
use MediaWiki\Auth\AuthManager; use MediaWiki\Auth\AuthManager;
use MediaWiki\Logger\LoggerFactory; use MediaWiki\Logger\LoggerFactory;
use LoginSignupSpecialPage; use MediaWiki\SpecialPage\LoginSignupSpecialPage;
use LoginHelper; use LoginHelper;
class SpecialIsekaiOIDCCallback extends LoginSignupSpecialPage { class SpecialIsekaiOIDCCallback extends LoginSignupSpecialPage {

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save