Go to the documentation of this file.
22 parent::__construct( $name,
'editmyprivateinfo' );
39 return AuthManager::ACTION_CHANGE;
44 $params = parent::getPreservedParams( $withToken );
46 'returnto' => $request->getVal(
'returnto' ),
47 'returntoquery' => $request->getVal(
'returntoquery' ),
63 if ( !$this->authRequests ) {
81 case AuthenticationResponse::PASS:
84 case AuthenticationResponse::FAIL:
88 throw new LogicException(
'invalid AuthenticationResponse' );
95 $this->authRequests = array_filter( $this->authRequests,
function ( $req ) use (
$subPage ) {
96 return $req->getUniqueId() ===
$subPage;
98 if ( count( $this->authRequests ) > 1 ) {
99 throw new LogicException(
'Multiple AuthenticationRequest objects with same ID!' );
105 if ( !static::$loadUserData ) {
108 $descriptor = parent::getAuthFormDescriptor( $requests, $action );
111 foreach ( $descriptor as &$field ) {
112 if ( $field[
'type'] ===
'password' && $field[
'name'] !==
'retype' ) {
114 if ( isset( $field[
'cssclass'] ) ) {
115 $field[
'cssclass'] .=
' mw-changecredentials-validate-password';
117 $field[
'cssclass'] =
'mw-changecredentials-validate-password';
123 $this->
getOutput()->addModules(
'mediawiki.misc-authed-ooui' );
131 $form = parent::getAuthForm( $requests, $action );
132 $req = reset( $requests );
133 $info = $req->describeCredentials();
136 Html::openElement(
'dl' )
137 . Html::element(
'dt', [], $this->
msg(
'credentialsform-provider' )->text() )
138 . Html::element(
'dd', [], $info[
'provider'] )
139 . Html::element(
'dt', [], $this->
msg(
'credentialsform-account' )->text() )
140 . Html::element(
'dd', [], $info[
'account'] )
141 . Html::closeElement(
'dl' )
145 $form->setSubmitTextMsg( static::$messagePrefix .
'-submit' );
160 if ( static::$loadUserData ) {
161 $requests = AuthenticationRequest::loadRequestsFromSubmission( $this->authRequests, $data );
177 $out->addHTML( $error->parse() );
180 $groupedRequests = [];
181 foreach ( $this->authRequests as $req ) {
182 $info = $req->describeCredentials();
183 $groupedRequests[(string)$info[
'provider']][] = $req;
187 $out->addHTML( Html::openElement(
'dl' ) );
188 foreach ( $groupedRequests as $group => $members ) {
189 $out->addHTML( Html::element(
'dt', [], $group ) );
190 foreach ( $members as $req ) {
192 $info = $req->describeCredentials();
193 $out->addHTML( Html::rawElement(
'dd', [],
195 $this->getPageTitle( $req->getUniqueId() ),
201 $out->addHTML( Html::closeElement(
'dl' ) );
211 SessionManager::singleton()->invalidateSessionsForUser( $user );
212 $session->setUser( $user );
216 $out->redirect( $returnUrl );
219 $out->wrapWikiMsg(
"<div class=\"successbox\">\n$1\n</div>", static::$messagePrefix
221 $out->returnToMain();
230 $returnTo = $request->getText(
'returnto' );
231 $returnToQuery = $request->getText(
'returntoquery',
'' );
238 return $title->getFullUrlForRedirect( $returnToQuery );
242 return $this->
getConfig()->get(
'ChangeCredentialsBlacklist' );
getAuthFormDescriptor( $requests, $action)
Generates a HTMLForm descriptor array from a set of authentication requests.
getPageTitle( $subpage=false)
Get a self-referential title object.
displayForm( $status)
Display the form.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
getOutput()
Get the OutputPage being used for this instance.
getAuthForm(array $requests, $action)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getRequestBlacklist()
Allows blacklisting certain request types.
static newMainPage(MessageLocalizer $localizer=null)
Create a new Title for the Main Page.
isListed()
Whether this special page is listed in Special:SpecialPages.
A special page subclass for authentication-related special pages.
__construct( $name='ChangeCredentials')
AuthenticationRequest[] $authRequests
handleFormSubmit( $data)
Submit handler callback for HTMLForm.
trySubmit()
Attempts to do an authentication step with the submitted data.
string $subPage
Subpage of the special page.
performAuthenticationStep( $action, array $requests)
getDefaultAction( $subPage)
Get the default action for this special page, if none is given via URL/POST data.
getConfig()
Shortcut to get main config object.
string $authAction
one of the AuthManager::ACTION_* constants.
getPreservedParams( $withToken=false)
Returns URL query parameters which can be used to reload the page (or leave and return) while preserv...
doesWrites()
Indicates whether this special page may perform database writes.
needsSubmitButton(array $requests)
Returns true if the form built from the given AuthenticationRequests needs a submit button.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
static $loadUserData
Change action needs user data; remove action does not.
loadAuth( $subPage, $authAction=null, $reset=false)
Load or initialize $authAction, $authRequests and $subPage.
static newGood( $value=null)
Factory function for good results.
Special change to change credentials (such as the password).
execute( $subPage)
Default execute method Checks user permissions.
getRequest()
Get the WebRequest being used for this instance.
showSubpageList( $error=null)
MediaWiki Linker LinkRenderer null $linkRenderer
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...