I want to add a button to `Special:UserLogin` so that users can choose between:
* using the regular MediaWiki login with a username and a password
* logging in via an external Single-Sign On system (which should just takes a click of a button)
So I tried implementing a [PrimaryAuthenticationProvider](https://doc.wikimedia.org/mediawiki-core/master/php/interfaceMediaWiki_1_1Auth_1_1PrimaryAuthenticationProvider.html):
```
class MyAuthProvider extends AbstractPrimaryAuthenticationProvider {
public function getAuthenticationRequests ( $action, array $options) {
return [
new ButtonAuthenticationRequest('some name', wfMessage('some label'), wfMessage('some help'), true),
];
}
// ... other methods
}
```
to my surprise this results in the following user interface:
{F35559035}
As it turns out that is this is because [LoginSignupSpecialPage calls](https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/tags/1.38.4/includes/specialpage/LoginSignupSpecialPage.php#660) the function [AuthenticationRequest::mergeFieldInfo](https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1Auth_1_1AuthenticationRequest.html#a9e88559e62029fae3233a86dcbceb2c4) to merge the fields from all authentication providers into one form.
This is completely inacceptable from a UX / accessibility standpoint. How are users supposed to understand that the button **in the middle** of the traditional login form uses a different authentication provider for which you don't have to fill out username and password? Even worse the username and password fields no longer have the HTML `required` attribute because `mergeFieldInfo` just takes the view that [fields that are required by some primary providers but not others are not actually required](https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/tags/1.38.4/includes/auth/AuthenticationRequest.php#320).
The right way to handle this would be to generate one form for every authentication provider, so users can simply choose which form to use and fields that are required for one authentication provider can actually be marked as required. And this would also be better from an UX standpoint because it would be clear for the user which fields belong to which authentication provider, instead of creating one Frankenstein form.