summaryrefslogtreecommitdiff
blob: caf7a9d6a756b5f2a2e21a37aa23f36fd0c4083a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

use MediaWiki\Auth\AuthManager;
use MediaWiki\Auth\ButtonAuthenticationRequest;

class PluggableAuthBeginAuthenticationRequest extends ButtonAuthenticationRequest {

	public function __construct() {
		if ( isset( $GLOBALS['wgPluggableAuth_ButtonLabelMessage'] ) ) {
			$label = wfMessage( $GLOBALS['wgPluggableAuth_ButtonLabelMessage'] );
		} elseif ( $GLOBALS['wgPluggableAuth_ButtonLabel'] ) {
			$label = new RawMessage( $GLOBALS['wgPluggableAuth_ButtonLabel'] );
		} else {
			$label = wfMessage( 'pluggableauth-loginbutton-label' );
		}
		parent::__construct(
			'pluggableauthlogin',
			$label,
			wfMessage( 'pluggableauth-loginbutton-help' ),
			true );
	}

	/**
	 * Returns field information.
	 * @return array field information
	 */
	public function getFieldInfo() {
		if ( $this->action !== AuthManager::ACTION_LOGIN ) {
			return [];
		}
		return array_merge( $GLOBALS['wgPluggableAuth_ExtraLoginFields'],
			parent::getFieldInfo() );
	}
}