(bug 44202) Account creation through API no longer leaks IP address of account creator
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Mon, 21 Jan 2013 11:03:46 +0000 (12:03 +0100)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Mon, 21 Jan 2013 21:00:25 +0000 (22:00 +0100)
commita9775ae5722059fe2c661751b0ddacc6d011f404
tree1761cd945fae3f223e09cb2df78a4b3ba5e92a84
parent0a384cd57366e9e0cfc22e733c866b19e8f747ff
(bug 44202) Account creation through API no longer leaks IP address of account creator

This happens when an anonymous user wants to create an account for himself through
the API. This is due to the fact that User::addNewUserLogEntry() was always using
$wgUser as performer, but the API does not replace $wgUser by the newly created user
object when the peformer is an anonymous user.

Changed User::addNewUserLogEntry() to directly take the log action as first parameter,
rather than a boolean value saying whether the password was sent by e-mail or not,
and force the performer to be the user itself in the log action is "create". This
avoids such problems in that case, no matter the value of $wgUser, and it makes this
parameter much more readable that the old one. Backward compatibility is maintained.

Creating an user and sending its password by e-mail will still log the performer's
IP address in the log if this is made by an anonymous user.

Finally the second parameter of the AddNewAccount is now correct when creating an
account from the API, it was always false previously.

Change-Id: I188ecf420b85e9d1dab6fb933ed50d5f58532109
includes/User.php
includes/api/ApiCreateAccount.php
includes/specials/SpecialUserlogin.php