3.15.3. password_reset

(Phorum 5 >= 5.2.13)

This hook is called after handling a password reset request. Based on whether a user account can be found for the provided email address and what the account status for that user is, different actions are performed by Phorum before calling this hook:

The main purpose of this hook is to log password reset requests.

Call time:

In login.php, after handling a password reset request.

Hook input:

An array containing four elements:

Hook output:

Same as input.

Example code:

function phorum_mod_foo_password_reset($data)
{
    $log = NULL;
    switch ($data['status'])
    {
        case 'new_password':
            $log = 'New password generated for ' .
                   $data['user']['username'] . ': ' .
                   $data['secret']; 
            break;
        case 'new_verification':
            $log = 'New verification code generated for ' .
                   $data['user']['username'] . ': ' .
                   $data['secret']; 
            break;
        case 'user_unknown':
            $log = 'Could not find a user for email ' .
                   $data['email'];
            break;
        case 'unapproved':
            $log = 'No new password generated for ' .
                   'unapproved user ' . $user['username'];
            break;
    }

    if ($log !== NULL) {
        log_the_password_reset($log);
    }

    return $user;
}