X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/includes/auth/ConfirmLinkAuthenticationRequest.php diff --git a/includes/auth/ConfirmLinkAuthenticationRequest.php b/includes/auth/ConfirmLinkAuthenticationRequest.php new file mode 100644 index 00000000..b82914f5 --- /dev/null +++ b/includes/auth/ConfirmLinkAuthenticationRequest.php @@ -0,0 +1,80 @@ +linkRequests = $linkRequests; + } + + public function getFieldInfo() { + $options = []; + foreach ( $this->linkRequests as $req ) { + $description = $req->describeCredentials(); + $options[$req->getUniqueId()] = wfMessage( + 'authprovider-confirmlink-option', + $description['provider']->text(), $description['account']->text() + ); + } + return [ + 'confirmedLinkIDs' => [ + 'type' => 'multiselect', + 'options' => $options, + 'label' => wfMessage( 'authprovider-confirmlink-request-label' ), + 'help' => wfMessage( 'authprovider-confirmlink-request-help' ), + 'optional' => true, + ] + ]; + } + + public function getUniqueId() { + return parent::getUniqueId() . ':' . implode( '|', array_map( function ( $req ) { + return $req->getUniqueId(); + }, $this->linkRequests ) ); + } + + /** + * Implementing this mainly for use from the unit tests. + * @param array $data + * @return AuthenticationRequest + */ + public static function __set_state( $data ) { + $ret = new static( $data['linkRequests'] ); + foreach ( $data as $k => $v ) { + $ret->$k = $v; + } + return $ret; + } +}