summaryrefslogtreecommitdiff
blob: 04831fb808a787393164438e640a2143aa2896be (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
35
<?php

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

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() );
	}
}