summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialPasswordReset.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialPasswordReset.php')
-rw-r--r--includes/specials/SpecialPasswordReset.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/includes/specials/SpecialPasswordReset.php b/includes/specials/SpecialPasswordReset.php
index 62731e98..efb57657 100644
--- a/includes/specials/SpecialPasswordReset.php
+++ b/includes/specials/SpecialPasswordReset.php
@@ -65,6 +65,9 @@ class SpecialPasswordReset extends FormSpecialPage {
'type' => 'text',
'label-message' => 'passwordreset-username',
);
+ if( $this->getUser()->isLoggedIn() ) {
+ $a['Username']['default'] = $this->getUser()->getName();
+ }
}
if ( isset( $wgPasswordResetRoutes['email'] ) && $wgPasswordResetRoutes['email'] ) {
@@ -95,7 +98,7 @@ class SpecialPasswordReset extends FormSpecialPage {
}
public function alterForm( HTMLForm $form ) {
- $form->setSubmitText( wfMessage( "mailmypassword" ) );
+ $form->setSubmitTextMsg( 'mailmypassword' );
}
protected function preText() {
@@ -110,7 +113,7 @@ class SpecialPasswordReset extends FormSpecialPage {
if ( isset( $wgPasswordResetRoutes['domain'] ) && $wgPasswordResetRoutes['domain'] ) {
$i++;
}
- return wfMessage( 'passwordreset-pretext', $i )->parseAsBlock();
+ return $this->msg( 'passwordreset-pretext', $i )->parseAsBlock();
}
/**
@@ -151,7 +154,7 @@ class SpecialPasswordReset extends FormSpecialPage {
$method = 'email';
$res = wfGetDB( DB_SLAVE )->select(
'user',
- '*',
+ User::selectFields(),
array( 'user_email' => $data['Email'] ),
__METHOD__
);
@@ -234,12 +237,12 @@ class SpecialPasswordReset extends FormSpecialPage {
$password = $user->randomPassword();
$user->setNewpassword( $password );
$user->saveSettings();
- $passwords[] = wfMessage( 'passwordreset-emailelement', $user->getName(), $password
- )->inLanguage( $userLanguage )->plain(); // We'll escape the whole thing later
+ $passwords[] = $this->msg( 'passwordreset-emailelement', $user->getName(), $password
+ )->inLanguage( $userLanguage )->text(); // We'll escape the whole thing later
}
$passwordBlock = implode( "\n\n", $passwords );
- $this->email = wfMessage( $msg )->inLanguage( $userLanguage );
+ $this->email = $this->msg( $msg )->inLanguage( $userLanguage );
$this->email->params(
$username,
$passwordBlock,
@@ -248,7 +251,7 @@ class SpecialPasswordReset extends FormSpecialPage {
round( $wgNewPasswordExpiry / 86400 )
);
- $title = wfMessage( 'passwordreset-emailtitle' );
+ $title = $this->msg( 'passwordreset-emailtitle' );
$this->result = $firstUser->sendMail( $title->escaped(), $this->email->escaped() );