51 parent::__construct(
'PasswordReset',
'editmyprivateinfo' );
61 return $this->passwordReset->isAllowed( $user )->isGood();
65 $status = Status::wrap( $this->passwordReset->isAllowed( $user ) );
66 if ( !$status->isGood() ) {
67 throw new ErrorPageError(
'internalerror', $status->getMessage() );
70 parent::checkExecutePermissions( $user );
78 $out->disallowUserJs();
79 parent::execute(
$par );
83 $resetRoutes = $this->
getConfig()->get(
'PasswordResetRoutes' );
85 if ( isset( $resetRoutes[
'username'] ) && $resetRoutes[
'username'] ) {
88 'default' => $this->
getRequest()->getSession()->suggestLoginUsername(),
89 'label-message' =>
'passwordreset-username',
92 if ( $this->
getUser()->isRegistered() ) {
93 $a[
'Username'][
'default'] = $this->
getUser()->getName();
97 if ( isset( $resetRoutes[
'email'] ) && $resetRoutes[
'email'] ) {
100 'label-message' =>
'passwordreset-email',
112 $resetRoutes = $this->
getConfig()->get(
'PasswordResetRoutes' );
119 if ( isset( $resetRoutes[
'username'] ) && $resetRoutes[
'username'] ) {
122 if ( isset( $resetRoutes[
'email'] ) && $resetRoutes[
'email'] ) {
126 $message = ( $i > 1 ) ?
'passwordreset-text-many' :
'passwordreset-text-one';
142 $username = $data[
'Username'] ??
null;
143 $email = $data[
'Email'] ??
null;
145 $this->method = $username ?
'username' :
'email';
146 $this->result = Status::wrap(
147 $this->passwordReset->execute( $this->getUser(), $username, $email ) );
149 if ( $this->result->hasMessage(
'actionthrottledtext' ) ) {
164 $output->addWikiMsg(
'passwordreset-success' );
165 $output->addWikiMsg(
'passwordreset-success-details-generic',
166 $this->
getConfig()->
get(
'PasswordReminderResendTime' ) );
170 $postVals = $this->
getRequest()->getPostValues();
171 if ( isset( $postVals[
'wpUsername'] ) && $postVals[
'wpUsername'] !==
'' ) {
172 $info .=
"* " . $this->
msg(
'passwordreset-username' ) .
' '
175 if ( isset( $postVals[
'wpEmail'] ) && $postVals[
'wpEmail'] !==
'' ) {
176 $info .=
"* " . $this->
msg(
'passwordreset-email' ) .
' '
179 $output->addWikiMsg(
'passwordreset-success-info', $info );
182 $output->returnToMain();
190 if ( $this->passwordReset->isAllowed( $this->getUser() )->isGood() ) {
191 return parent::isListed();
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
An error page which can definitely be safely rendered using the OutputPage.
Special page which uses an HTMLForm to handle processing.
string null $par
The sub-page of the special page.
Helper class for the password reset functionality shared by the web UI and the API.
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.
getRequest()
Get the WebRequest being used for this instance.
Special page for requesting a password reset email.
getDisplayFormat()
Get display format for the form.
__construct(PasswordReset $passwordReset)
getFormFields()
Get an HTMLForm descriptor array.
doesWrites()
Indicates whether this special page may perform database writes.
string $method
Identifies which password reset field was specified by the user.
onSuccess()
Show a message on the successful processing of the form.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
isListed()
Hide the password reset page if resets are disabled.
onSubmit(array $data)
Process the form.
PasswordReset $passwordReset
checkExecutePermissions(User $user)
Called from execute() to check if the given user can perform this action.
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Show an error when the user hits a rate limit.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...