Page MenuHomePhabricator

AuthManager: Providers need to supply HTMLSubmitField or HTMLInfoField to suppress the default submit button on LinkAccounts
Closed, ResolvedPublic

Description

If an extension provides a PrimaryAuthenticationProvider which supports to link to existing user accounts, it has to supply an AuthenticationRequest that describes the form fields needed to link an account, This can be a button only, e.g. a submit button, in which case AuthManagerSpecialPage will omit the default submit button of HTMLForm. To identify, if a default submit button is needed or not, the form descriptor is searched for containing either HTMLSubmitField or HTMLInfoField (in which case it's assumed that no default submit button is needed).[1] Unfortunatly, the list of classes is hard coded, which means, that other classes (which probably just inherit from one of these classes) can't omit the default submit button, even if they don't need it.

To solve this problem, it could be a solution to add a special key to the formdescriptor array (e.g. dismissAuthManagerSubmit), which, if set, also let AuthManagerSpecialPage omit the default submit.

I ran into this problem in: https://gerrit.wikimedia.org/r/#/c/289099/34/includes/GoogleLogin.hooks.php

How it looks like after applying the GoogleLogin change:

While it should look like:

[1] https://github.com/wikimedia/mediawiki/blob/801db2a0e2be2b14a6f997b127b5880eade5cd2a/includes/specialpage/AuthManagerSpecialPage.php#L565-L575

Event Timeline

Florian created this task.Jun 7 2016, 6:13 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 7 2016, 6:13 PM
Anomie added a comment.EditedJun 7 2016, 6:52 PM

Another simpler solution would be to change the check to !is_a( $class, \HTMLInfoField::class, true ) && !is_a( $class, \HTMLSubmitField::class, true ), if we assume that custom fields will subclass something appropriate.

Florian claimed this task.Jun 7 2016, 8:55 PM

Change 293215 had a related patch set uploaded (by Florianschmidtwelzow):
AuthManagerSpecialPage: Don't use fixed submit/info class for submit button check

https://gerrit.wikimedia.org/r/293215

Change 293215 merged by jenkins-bot:
AuthManagerSpecialPage: Don't use fixed submit/info class for submit button check

https://gerrit.wikimedia.org/r/293215

Tgr closed this task as Resolved.Jun 9 2016, 12:15 PM

Thanks for fixing, Florian!

Thanks for merging Gergő! :)

Change 293776 had a related patch set uploaded (by Gergő Tisza):
AuthManagerSpecialPage: Don't use fixed submit/info class for submit button check

https://gerrit.wikimedia.org/r/293776

Change 293776 merged by jenkins-bot:
AuthManagerSpecialPage: Don't use fixed submit/info class for submit button check

https://gerrit.wikimedia.org/r/293776