23 parent::__construct( $name,
'editmyprivateinfo' );
40 return AuthManager::ACTION_CHANGE;
45 $params = parent::getPreservedParams( $withToken );
47 'returnto' => $request->getVal(
'returnto' ),
48 'returntoquery' => $request->getVal(
'returntoquery' ),
64 if ( !$this->authRequests ) {
74 if ( $status ===
false || !$status->isOK() ) {
79 $response = $status->getValue();
81 switch ( $response->status ) {
82 case AuthenticationResponse::PASS:
85 case AuthenticationResponse::FAIL:
86 $this->
displayForm( Status::newFatal( $response->message ) );
89 throw new LogicException(
'invalid AuthenticationResponse' );
97 foreach ( $this->authRequests as $req ) {
98 if ( $req->getUniqueId() ===
$subPage ) {
102 if ( count( $foundReqs ) > 1 ) {
103 throw new LogicException(
'Multiple AuthenticationRequest objects with same ID!' );
105 $this->authRequests = $foundReqs;
111 array $requests, array $fieldInfo, array &$formDescriptor, $action
113 parent::onAuthChangeFormFields( $requests, $fieldInfo, $formDescriptor, $action );
116 if ( AuthenticationRequest::getRequestByClass( $this->authRequests,
117 PasswordAuthenticationRequest::class )
121 'autocomplete' =>
'new-password',
122 'placeholder-message' =>
'createacct-yourpassword-ph',
123 'help-message' =>
'createacct-useuniquepass',
126 'autocomplete' =>
'new-password',
127 'placeholder-message' =>
'createacct-yourpasswordagain-ph',
134 if ( !static::$loadUserData ) {
137 $descriptor = parent::getAuthFormDescriptor( $requests, $action );
140 foreach ( $descriptor as &$field ) {
141 if ( $field[
'type'] ===
'password' && $field[
'name'] !==
'retype' ) {
143 if ( isset( $field[
'cssclass'] ) ) {
144 $field[
'cssclass'] .=
' mw-changecredentials-validate-password';
146 $field[
'cssclass'] =
'mw-changecredentials-validate-password';
152 $this->
getOutput()->addModules(
'mediawiki.misc-authed-ooui' );
160 $form = parent::getAuthForm( $requests, $action );
161 $req = reset( $requests );
162 $info = $req->describeCredentials();
165 Html::openElement(
'dl' )
166 . Html::element(
'dt', [], $this->
msg(
'credentialsform-provider' )->text() )
167 . Html::element(
'dd', [], $info[
'provider'] )
168 . Html::element(
'dt', [], $this->
msg(
'credentialsform-account' )->text() )
169 . Html::element(
'dd', [], $info[
'account'] )
170 . Html::closeElement(
'dl' )
174 $form->setSubmitTextMsg( static::$messagePrefix .
'-submit' );
175 $form->showCancel()->setCancelTarget( $this->
getReturnUrl() ?: Title::newMainPage() );
189 if ( static::$loadUserData ) {
190 $requests = AuthenticationRequest::loadRequestsFromSubmission( $this->authRequests, $data );
196 return Status::newGood( $response );
206 $out->addHTML( $error->parse() );
209 $groupedRequests = [];
210 foreach ( $this->authRequests as $req ) {
211 $info = $req->describeCredentials();
212 $groupedRequests[(string)$info[
'provider']][] = $req;
216 $out->addHTML( Html::openElement(
'dl' ) );
217 foreach ( $groupedRequests as $group => $members ) {
218 $out->addHTML( Html::element(
'dt', [], $group ) );
219 foreach ( $members as $req ) {
221 $info = $req->describeCredentials();
222 $out->addHTML( Html::rawElement(
'dd', [],
224 $this->getPageTitle( $req->getUniqueId() ),
230 $out->addHTML( Html::closeElement(
'dl' ) );
240 SessionManager::singleton()->invalidateSessionsForUser( $user );
241 $session->setUser( $user );
245 $out->redirect( $returnUrl );
248 $out->wrapWikiMsg(
"<div class=\"successbox\">\n$1\n</div>", static::$messagePrefix
250 $out->returnToMain();
259 $returnTo = $request->getText(
'returnto' );
260 $returnToQuery = $request->getText(
'returntoquery',
'' );
266 $title = Title::newFromText( $returnTo );
267 return $title->getFullUrlForRedirect( $returnToQuery );
271 return $this->
getConfig()->get(
'ChangeCredentialsBlacklist' );
A special page subclass for authentication-related special pages.
string $authAction
one of the AuthManager::ACTION_* constants.
performAuthenticationStep( $action, array $requests)
displayForm( $status)
Display the form.
AuthenticationRequest[] $authRequests
string $subPage
Subpage of the special page.
static mergeDefaultFormDescriptor(array $fieldInfo, array $formDescriptor, array $defaultFormDescriptor)
Apply defaults to a form descriptor, without creating non-existend fields.
getRequest()
Get the WebRequest being used for this instance.
trySubmit()
Attempts to do an authentication step with the submitted data.
Special change to change credentials (such as the password).
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
showSubpageList( $error=null)
getAuthForm(array $requests, $action)
Stable to override.
doesWrites()
Indicates whether this special page may perform database writes.
handleFormSubmit( $data)
Submit handler callback for HTMLForm.
getPreservedParams( $withToken=false)
Returns URL query parameters which can be used to reload the page (or leave and return) while preserv...
isListed()
Whether this special page is listed in Special:SpecialPages Stable to override.
getRequestBlacklist()
Allows blacklisting certain request types.
getAuthFormDescriptor( $requests, $action)
Generates a HTMLForm descriptor array from a set of authentication requests.
loadAuth( $subPage, $authAction=null, $reset=false)
Load or initialize $authAction, $authRequests and $subPage.
__construct( $name='ChangeCredentials')
getDefaultAction( $subPage)
Get the default action for this special page, if none is given via URL/POST data.
needsSubmitButton(array $requests)
Returns true if the form built from the given AuthenticationRequests needs a submit button.
static $loadUserData
Change action needs user data; remove action does not.
execute( $subPage)
Default execute method Checks user permissions.
onAuthChangeFormFields(array $requests, array $fieldInfo, array &$formDescriptor, $action)
Change the form descriptor that determines how a field will look in the authentication form....
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!...
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getPageTitle( $subpage=false)
Get a self-referential title object.
MediaWiki Linker LinkRenderer null $linkRenderer