public static function reset_user_password(Admin_UserEntry $user_entry)
    {
        $real_name = $user_entry->get_real_name();
        /*
         * Check that the user has an email address to send the
         * new password to.
         */
        if (strlen($user_entry->get_email()) == 0) {
            throw new Exception('Unable to reset the password of ' . $user_entry->get_real_name() . ' as no email address has been set!');
        }
        /*
         * Generate the new password.
         */
        $pwg = Security_PasswordGenerator::get_instance();
        $pw = $pwg->get_password();
        /*
         * Check that there is an admin for this site.
         */
        $from_email = '';
        /*
         * Compose an email.
         *
         * How can this be edited and overridden?
         */
        $email_title = 'New password for ' . $user_entry->get_real_name();
        $to_email = $user_entry->get_email();
        $email_body = <<<EML
Dear {$real_name},

Your password has been reset to '{$pw}'.
EML;
        if (mail($to_email, $from_email, $email_body, "From: {$from_email};\r\nReply-To: {$from_email}")) {
            $alm = Admin_LoginManager::get_instance();
            $alm->set_password($user_entry->get_name(), $pw);
        } else {
            throw new Exception("Unable to send a password reset email to {$to_email}!");
        }
    }
 /**
  * Resets the password of the user with the given name.
  *
  * First checks that their is an account with that name,
  * throws a HaddockProjectOrganisation_PasswordResetException
  * if there isn't.
  *
  * Then it generates a new password.
  *
  * The password is emailed to the user.
  *
  * The password is then set to the encrypted form of the password.
  */
 public function reset_password($name)
 {
     //throw
     //    new HaddockProjectOrganisation_PasswordResetException($name);
     /*
      * Check is user.
      */
     if (!$this->is_user($name)) {
         throw new HaddockProjectOrganisation_PasswordResetException($name);
     }
     /*
      * Generate a new password.
      */
     $password_generator = Security_PasswordGenerator::get_instance();
     $new_password = $password_generator->get_password($this->get_new_password_length());
     /*
      * Email the password to the user.
      */
     $this->email_user_new_password($name, $new_password);
     /*
      * Update the values in the database.
      */
     $this->set_password($name, $new_password);
 }
    $p_f_not_yet_p = new HTMLTags_P('This project doesn\'t have a password file yet ...');
    $content_div->append_tag_to_content($p_f_not_yet_p);
    /*
     * The default host.
     */
    $host = 'localhost';
    /*
     * The username and database are suggested by the project directory.
     */
    $username = $project_directory->get_database_username_suggestion();
    $database = $project_directory->get_database_name_suggestion();
    /*
     * Generate a random password.
     */
    $password_length = 12;
    $password_generator = Security_PasswordGenerator::get_instance();
    $password = $password_generator->get_password($password_length);
}
/*
 * -----------------------------------------------------------------------------
 */
$password_management_form = new HTMLTags_SimpleOLForm('password_management');
$p_m_f_action_url = new HTMLTags_URL();
$p_m_f_action_url->set_file('/admin/redirect-script.php');
$p_m_f_action_url->set_get_variable('module', 'database');
$p_m_f_action_url->set_get_variable('page', 'passwords-file-management');
$password_management_form->set_action($p_m_f_action_url);
$password_management_form->set_legend_text('Password Management');
$password_management_form->add_input_name_with_value('host', $host);
$password_management_form->add_input_name_with_value('username', $username);
$password_management_form->add_input_name_with_value('database', $database);