| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\User\Hook; |
| 4 | |
| 5 | use MediaWiki\User\User; |
| 6 | use Wikimedia\Message\MessageSpecifier; |
| 7 | |
| 8 | /** |
| 9 | * This is a hook handler interface, see docs/Hooks.md. |
| 10 | * Use the hook name "SpecialPasswordResetOnSubmit" to register handlers implementing this interface. |
| 11 | * |
| 12 | * @stable to implement |
| 13 | * @ingroup Hooks |
| 14 | */ |
| 15 | interface SpecialPasswordResetOnSubmitHook { |
| 16 | /** |
| 17 | * This hook is called when executing a form submission on Special:PasswordReset. |
| 18 | * |
| 19 | * The data submitted by the user ($data) is an associative array with the keys 'Username' and |
| 20 | * 'Email', whose values are already validated user input (a valid username, and a valid email |
| 21 | * address), or null if not given by the user. At least one of the values is not null. |
| 22 | * |
| 23 | * Since MediaWiki 1.43, hook handlers should check each user's 'requireemail' preference, and |
| 24 | * if it is enabled by the user, only return that user if both username and email were present. |
| 25 | * Until MediaWiki 1.42 only one of username and email could be present (the other would be null). |
| 26 | * |
| 27 | * @since 1.35 |
| 28 | * |
| 29 | * @param User[] &$users |
| 30 | * @param array $data Array of data submitted by the user |
| 31 | * @phan-param array{Username:?string, Email:?string} $data |
| 32 | * @param string|array|MessageSpecifier &$error String, error code (message key) |
| 33 | * used to describe to error (out parameter). The hook needs to return false |
| 34 | * when setting this, otherwise it will have no effect. |
| 35 | * @return bool|void True or no return value to continue or false to abort |
| 36 | */ |
| 37 | public function onSpecialPasswordResetOnSubmit( &$users, $data, &$error ); |
| 38 | } |