public function getUserInstance( User &$user ) {
return new AuthPluginUser( $user );
}
+
+ /**
+ * Get a list of domains (in HTMLForm options format) used.
+ *
+ * @return array
+ */
+ public function domainList() {
+ return array();
+ }
}
class AuthPluginUser {
}
protected function getFormFields() {
- global $wgPasswordResetRoutes;
+ global $wgPasswordResetRoutes, $wgAuth;
$a = array();
if ( isset( $wgPasswordResetRoutes['username'] ) && $wgPasswordResetRoutes['username'] ) {
$a['Username'] = array(
);
}
+ if ( isset( $wgPasswordResetRoutes['domain'] ) && $wgPasswordResetRoutes['domain'] ) {
+ $domains = $wgAuth->domainList();
+ $a['Domain'] = array(
+ 'type' => 'select',
+ 'options' => $domains,
+ 'label-message' => 'passwordreset-domain',
+ );
+ }
+
return $a;
}
if ( isset( $wgPasswordResetRoutes['email'] ) && $wgPasswordResetRoutes['email'] ) {
$i++;
}
+ if ( isset( $wgPasswordResetRoutes['domain'] ) && $wgPasswordResetRoutes['domain'] ) {
+ $i++;
+ }
return wfMessage( 'passwordreset-pretext', $i )->parseAsBlock();
}
* @return Bool|Array
*/
public function onSubmit( array $data ) {
+ global $wgAuth;
+
+ if ( isset( $data['Domain'] ) ) {
+ if ( $wgAuth->validDomain( $data['Domain'] ) ) {
+ $wgAuth->setDomain( $data['Domain'] );
+ } else {
+ $wgAuth->setDomain( 'invaliddomain' );
+ }
+ }
if ( isset( $data['Username'] ) && $data['Username'] !== '' ) {
$method = 'username';
'passwordreset-disabled' => 'Password resets have been disabled on this wiki.',
'passwordreset-pretext' => '{{PLURAL:$1||Enter one of the pieces of data below}}',
'passwordreset-username' => 'Username:',
+'passwordreset-domain' => 'Domain:',
'passwordreset-email' => 'E-mail address:',
'passwordreset-emailtitle' => 'Account details on {{SITENAME}}',
'passwordreset-emailtext-ip' => 'Someone (probably you, from IP address $1) requested a reminder of your