MediaWiki REL1_37
PasswordDomainAuthenticationRequest.php
Go to the documentation of this file.
1<?php
22namespace MediaWiki\Auth;
23
32 private $domainList;
33
35 public $domain = null;
36
41 public function __construct( array $domainList ) {
42 $this->domainList = $domainList;
43 }
44
49 public function getFieldInfo() {
50 $ret = parent::getFieldInfo();
51
52 // Only add a domain field if we have the username field included
53 if ( isset( $ret['username'] ) ) {
54 $ret['domain'] = [
55 'type' => 'select',
56 'options' => [],
57 'label' => wfMessage( 'yourdomainname' ),
58 'help' => wfMessage( 'authmanager-domain-help' ),
59 ];
60 foreach ( $this->domainList as $domain ) {
61 $ret['domain']['options'][$domain] = new \RawMessage( '$1', [ $domain ] );
62 }
63 }
64
65 return $ret;
66 }
67
72 public function describeCredentials() {
73 return [
74 'provider' => wfMessage( 'authmanager-provider-password-domain' ),
75 'account' => wfMessage(
76 'authmanager-account-password-domain', [ $this->username, $this->domain ]
77 ),
78 ];
79 }
80
86 public static function __set_state( $data ) {
87 $ret = new static( $data['domainList'] );
88 foreach ( $data as $k => $v ) {
89 if ( $k !== 'domainList' ) {
90 $ret->$k = $v;
91 }
92 }
93 return $ret;
94 }
95}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
This is a value object for authentication requests with a username and password.
This is a value object for authentication requests with a username, password, and domain.
getFieldInfo()
Fetch input field info.The field info is an associative array mapping field names to info arrays....
describeCredentials()
Describe the credentials represented by this request.This is used on requests returned by Authenticat...