]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/recoverpassword.php
I think all the notice deletion calls are event-compatible now
[quix0rs-gnu-social.git] / actions / recoverpassword.php
index 46df772b73214047dcd05351e5cda52ef216e6ae..1cbb73fd4a21fa5528fcabcaf6506dfb4848b083 100644 (file)
@@ -105,12 +105,8 @@ class RecoverpasswordAction extends Action
         if (!$user->email) {
             $orig = clone($user);
             $user->email = $email;
-            $result = $user->updateWithKeys($orig);
-            if (!$result) {
-                common_log_db_error($user, 'UPDATE', __FILE__);
-                // TRANS: Server error displayed when updating a user's e-mail address in the database fails while recovering a password.
-                $this->serverError(_('Could not update user with confirmed email address.'));
-            }
+            // Throws exception on failure.
+            $user->updateWithKeys($orig);
         }
 
         // Success!
@@ -276,10 +272,16 @@ class RecoverpasswordAction extends Action
         try {
             User::recoverPassword($nore);
             $this->mode = 'sent';
-            // TRANS: User notification after an e-mail with instructions was sent from the password recovery form.
-            $this->msg = _('Instructions for recovering your password ' .
-                           'have been sent to the email address registered to your ' .
-                           'account.');
+            if (common_is_email($nore) && common_config('site', 'fakeaddressrecovery')) {
+                // TRANS: User notification when recovering password by giving email address,
+                //        regardless if the mail was sent or not (to hide registered email status).
+                $this->msg = _('If the email address you provided was found in the database, a recovery mail with instructions has been sent there.');
+            } else {
+                // TRANS: User notification after an e-mail with instructions was sent from the password recovery form.
+                $this->msg = _('Instructions for recovering your password ' .
+                               'have been sent to the email address registered to your ' .
+                               'account.');
+            }
             $this->success = true;
         } catch (Exception $e) {
             $this->success = false;
@@ -323,7 +325,7 @@ class RecoverpasswordAction extends Action
 
         $original = clone($user);
 
-        $user->password = common_munge_password($newpassword, $user->id);
+        $user->password = common_munge_password($newpassword, $user->getProfile());
 
         if (!$user->update($original)) {
             common_log_db_error($user, 'UPDATE', __FILE__);