50 parent::__construct(
'PasswordReset',
'editmyprivateinfo' );
54 if ( $this->passwordReset ===
null ) {
55 $this->passwordReset = MediaWikiServices::getInstance()->getPasswordReset();
70 if ( !$status->isGood() ) {
71 throw new ErrorPageError(
'internalerror', $status->getMessage() );
74 parent::checkExecutePermissions( $user );
82 $out->disallowUserJs();
83 parent::execute(
$par );
87 $resetRoutes = $this->
getConfig()->get(
'PasswordResetRoutes' );
89 if ( isset( $resetRoutes[
'username'] ) && $resetRoutes[
'username'] ) {
92 'default' => $this->
getRequest()->getSession()->suggestLoginUsername(),
93 'label-message' =>
'passwordreset-username',
96 if ( $this->
getUser()->isLoggedIn() ) {
97 $a[
'Username'][
'default'] = $this->
getUser()->getName();
101 if ( isset( $resetRoutes[
'email'] ) && $resetRoutes[
'email'] ) {
104 'label-message' =>
'passwordreset-email',
116 $resetRoutes = $this->
getConfig()->get(
'PasswordResetRoutes' );
123 if ( isset( $resetRoutes[
'username'] ) && $resetRoutes[
'username'] ) {
126 if ( isset( $resetRoutes[
'email'] ) && $resetRoutes[
'email'] ) {
130 $message = ( $i > 1 ) ?
'passwordreset-text-many' :
'passwordreset-text-one';
146 $username = $data[
'Username'] ??
null;
147 $email = $data[
'Email'] ??
null;
149 $this->method = $username ?
'username' :
'email';
150 $this->result = Status::wrap(
153 if ( $this->result->hasMessage(
'actionthrottledtext' ) ) {
161 if ( $this->method ===
'email' ) {
162 $this->
getOutput()->addWikiMsg(
'passwordreset-emailsentemail' );
164 $this->
getOutput()->addWikiMsg(
'passwordreset-emailsentusername' );
176 return parent::isListed();
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.
getFormFields()
Get an HTMLForm descriptor array.
doesWrites()
Indicates whether this special page may perform database writes.
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
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,...