X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FUser.php;h=6e52a1d980246239aacb436dfd38ac7c32ee0758;hb=a759297ac827f87a31c28e2623541788ef55b7a5;hp=0dfdfc4c14aced53766696a80a192f81c388d5d0;hpb=103291b11e8af8361ce0cd19d430dc3cf3d56192;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/User.php b/includes/User.php index 0dfdfc4c14..6e52a1d980 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2478,6 +2478,11 @@ class User implements IDBAccessObject { * @param bool $throttle If true, reset the throttle timestamp to the present */ public function setNewpassword( $str, $throttle = true ) { + $id = $this->getId(); + if ( $id == 0 ) { + throw new LogicException( 'Cannot set new password for a user that is not in the database.' ); + } + $dbw = wfGetDB( DB_MASTER ); $passwordFactory = new PasswordFactory();