Page MenuHomePhabricator

OAuthAuthentication throws 'Call to undefined method LoginForm::successfulLogin()' after login
Closed, DuplicatePublic

Description

After a successful OAuthAuth login, user is presented with an error message like:

[1[...]9] /wiki/Special:OAuthLogin/finish?oauth_verifier=e[...]0&oauth_token=c[...]4 Error from line 98 of /srv/mediawiki/extensions/OAuthAuthentication/specials/SpecialOAuthLogin.php: Call to undefined method LoginForm::successfulLogin()

Backtrace:

#0 /srv/mediawiki/includes/specialpage/SpecialPage.php(569): MediaWiki\Extensions\OAuthAuthentication\SpecialOAuthLogin->execute(string)
#1 /srv/mediawiki/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(string)
#2 /srv/mediawiki/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#3 /srv/mediawiki/includes/MediaWiki.php(860): MediaWiki->performRequest()
#4 /srv/mediawiki/includes/MediaWiki.php(517): MediaWiki->main()
#5 /srv/mediawiki/index.php(42): MediaWiki->run()
#6 {main}

The login itself is successful.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 18 2018, 4:32 AM

Searching for this method I see rMW73e23d6643fe99ef71ccf29b6ff7dcd713099cbb (linked to T110277). @Tgr Could you look into this?

I added a very hacky patch to make this error message disappear:

diff --git a/specials/SpecialOAuthLogin.php b/specials/SpecialOAuthLogin.php
index adb0ed3..f59c77b 100644
--- a/specials/SpecialOAuthLogin.php
+++ b/specials/SpecialOAuthLogin.php
@@ -92,10 +92,9 @@ class SpecialOAuthLogin extends \UnlistedSpecialPage {
                                $this->getContext()->setUser( $u );
                                $wgUser = $u;
 
-                               $lp = new \LoginForm();
-
-                               // Call LoginForm::successfulCreation() on create, or successfulLogin()
-                               $lp->$method();
+                               $r = new \ReflectionMethod('\SpecialUserLogin', 'successfulAction');
+                               $r->setAccessible(true);
+                               $r->invoke(new \SpecialUserLogin());
                                                break;
                        default:
                                throw new \ErrorPageError( 'oauthauth-error', 'oauthauth-invalid-subpage' );

Sigh...