From 80ee12ab5c488bf91a41ed2133351db5b502dec2 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 14 Aug 2008 00:18:21 +0000 Subject: [PATCH] * Fix location of $ip check * Add User::mailPasswordInternal hook for bug 14630 --- docs/hooks.txt | 5 +++++ includes/specials/SpecialUserlogin.php | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 7c9218aafc..caec45824d 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1262,6 +1262,11 @@ string &$error: output: HTML error to show if upload canceled by returning false 'UploadComplete': Upon completion of a file upload $uploadForm: Upload form object. File can be accessed by $uploadForm->mLocalFile. +'User::mailPasswordInternal': before creation and mailing of a user's new temporary password +$user: the user who sent the message out +$ip: IP of the user who sent the message out +$u: the account whose new password will be set + 'UserArrayFromResult': called when creating an UserArray object from a database result &$userArray: set this to an object to override the default object returned $res: database result used to create the object diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 13df18a4b7..cc9c927b77 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -640,21 +640,21 @@ class LoginForm { */ function mailPasswordInternal( $u, $throttle = true, $emailTitle = 'passwordremindertitle', $emailText = 'passwordremindertext' ) { global $wgCookiePath, $wgCookieDomain, $wgCookiePrefix, $wgCookieSecure; - global $wgServer, $wgScript; + global $wgServer, $wgScript, $wgUser; if ( '' == $u->getEmail() ) { return new WikiError( wfMsg( 'noemail', $u->getName() ) ); } - - $np = $u->randomPassword(); - $u->setNewpassword( $np, $throttle ); - $u->saveSettings(); - $ip = wfGetIP(); if( !$ip ) { return new WikiError( wfMsg( 'badipaddress' ) ); } - #if ( '' == $ip ) { $ip = '(Unknown)'; } + + wfRunHooks( 'User::mailPasswordInternal', array(&$wgUser, &$ip, &$u) ); + + $np = $u->randomPassword(); + $u->setNewpassword( $np, $throttle ); + $u->saveSettings(); $m = wfMsg( $emailText, $ip, $u->getName(), $np, $wgServer . $wgScript ); $result = $u->sendMail( wfMsg( $emailTitle ), $m ); -- 2.20.1