solidcodes, this takes a little tweaking. So for instance let's say I have an admin login at examples/alt_login:
config/authentication.php
PHP Code:
$config['allowed_pages_for_login'] = array(
'examples/alt_login'
);
controllers/Examples.php
PHP Code:
public function alt_login()
{
if( strtolower( $_SERVER['REQUEST_METHOD'] ) == 'post' )
{
$this->require_min_level(1);
}
$this->setup_login_form();
$html = $this->load->view('examples/page_header', '', TRUE);
$html .= $this->load->view('examples/login_form', '', TRUE);
$html .= $this->load->view('examples/page_footer', '', TRUE);
echo $html;
}
_redirect_to_login_page method in core/Auth_controller.php is changed slightly:
PHP Code:
// No need to redirect to the login form if alternate login page
if( ! in_array( $this->uri->uri_string(), config_item('allowed_pages_for_login') ) )
{
// Redirect to the login form
header(
'Location: ' . secure_site_url( LOGIN_PAGE . '?redirect=' . $redirect ),
TRUE,
302
);
}
setup_login_form method in core/Auth_controller.php is changed slightly:
PHP Code:
// Login URL may be an alternate
$login_urls = config_item('allowed_pages_for_login');
foreach( $login_urls as $login_url )
{
// Login URL is an alternate (not optional)
if( $this->uri->uri_string() == $login_url && ! $optional_login )
{
$view_data['login_url'] = secure_site_url( $login_url );
break;
}
}
if( ! isset( $view_data['login_url'] ) )
{
$view_data['login_url'] = secure_site_url( LOGIN_PAGE . $redirect );
}
So because you already have your admin login form, you'll probably just need to change the methods in Auth_controller.php. I had never expected this kind of usage, and honestly it is a little strange for me to wrap my head around. I think it is better to use Community Auth as it was intended to be used, so such changes will probably not be put into Community Auth, unless other feedback shows that it is likely to be a feature that more people will want. I hope this helps you.