6.0.0-git
2019-11-11

Diff for CpanelAuthHowTo between 1 and 2

Save the following file (also attached to this page) to {{horde/lib/Auth/cpanel.php}}:

<code type="php">
<?php

require_once dirname(__FILE__) . '/imap.php';

class Auth_cpanel extends Auth_imap {

    /**
     * Constructs a new cpanel authentication object.
     *
     * @param array $params  A hash containing connection parameters.
     */
    function Auth_cpanel($params = array())
    {
        $this->capabilities['transparent'] = true;
        parent::Auth_imap($params);
    }

    /**
     * Automatic authentication.
     *
     * @return boolean  Whether or not the client is allowed.
     */
    function transparent()
    {
        if ($this->_authenticate(getenv('REMOTE_USER'),
                                 array('password' => getenv('REMOTE_PASSWORD')))) {
            $this->setAuth(getenv('REMOTE_USER'),
                           array('transparent' => 1,
                                 'password' => getenv('REMOTE_PASSWORD')));
            return true;
        } else {
            return false;
        }
    }

}
</code>

TheThen add the following line to {{horde/config/conf.php}} //after// the line saying {{/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */}}:

<code type="php">
$conf['auth']['driver'] = 'cpanel';
</code>

Don't change anything else in the {{conf.php}} file.