MediaWiki
1.30.0
|
Helper class for the password reset functionality shared by the web UI and the API. More...
Public Member Functions | |
__construct (Config $config, AuthManager $authManager) | |
execute (User $performingUser, $username=null, $email=null) | |
Do a password reset. More... | |
isAllowed (User $user) | |
Check if a given user has permission to use this functionality. More... | |
setLogger (LoggerInterface $logger) | |
Set the logger instance to use. More... | |
Protected Member Functions | |
getUsersByEmail ( $email) | |
isBlocked (User $user) | |
Check whether the user is blocked. More... | |
Protected Attributes | |
AuthManager | $authManager |
Config | $config |
LoggerInterface | $logger |
Private Attributes | |
HashBagOStuff | $permissionCache |
In-process cache for isAllowed lookups, by username. More... | |
Helper class for the password reset functionality shared by the web UI and the API.
Requires the TemporaryPasswordPrimaryAuthenticationProvider and the EmailNotificationSecondaryAuthenticationProvider (or something providing equivalent functionality) to be enabled.
Definition at line 36 of file PasswordReset.php.
PasswordReset::__construct | ( | Config | $config, |
AuthManager | $authManager | ||
) |
Definition at line 53 of file PasswordReset.php.
References $authManager, and $config.
PasswordReset::execute | ( | User | $performingUser, |
$username = null , |
|||
$email = null |
|||
) |
Do a password reset.
Authorization is the caller's responsibility.
Process the form. At this point we know that the user passes all the criteria in userCanExecute(), and if the data array contains 'Username', etc, then Username resets are allowed.
User | $performingUser | The user that does the password reset |
string | $username | The user whose password is reset |
string | Alternative way to specify the user |
LogicException | When the user is not allowed to perform the action |
MWException | On unexpected DB errors |
Definition at line 132 of file PasswordReset.php.
References $req, $user, $username, as, false, User\getId(), User\getName(), User\getRequest(), getUsersByEmail(), isAllowed(), StatusValue\newFatal(), User\newFromName(), StatusValue\newGood(), User\pingLimiter(), Hooks\run(), wfEscapeWikiText(), and wfMessage().
|
protected |
string |
MWException | On unexpected database errors |
Definition at line 290 of file PasswordReset.php.
References $res, as, DB_REPLICA, User\newFromRow(), User\selectFields(), and wfGetDB().
Referenced by execute().
PasswordReset::isAllowed | ( | User | $user | ) |
Check if a given user has permission to use this functionality.
User | $user | |
bool | $displayPassword | If set, also check whether the user is allowed to reset the password of another user and see the temporary password. |
Definition at line 78 of file PasswordReset.php.
References $user, isBlocked(), StatusValue\newFatal(), and StatusValue\newGood().
Referenced by execute().
|
protected |
Check whether the user is blocked.
Ignores certain types of system blocks that are only meant to force users to log in.
User | $user |
Definition at line 261 of file PasswordReset.php.
Referenced by isAllowed().
PasswordReset::setLogger | ( | LoggerInterface | $logger | ) |
Set the logger instance to use.
LoggerInterface | $logger |
Definition at line 66 of file PasswordReset.php.
References $logger.
|
protected |
Definition at line 41 of file PasswordReset.php.
Referenced by __construct().
|
protected |
Definition at line 38 of file PasswordReset.php.
Referenced by __construct().
|
protected |
Definition at line 44 of file PasswordReset.php.
Referenced by setLogger().
|
private |
In-process cache for isAllowed lookups, by username.
Contains a StatusValue object
Definition at line 51 of file PasswordReset.php.