Welcome Guest, Not a member yet? Register   Sign In
Community Auth Learning...
#37

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_urlLOGIN_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_urlLOGIN_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.
Reply


Messages In This Thread
Community Auth Learning... - by solidcodes - 08-18-2015, 10:30 PM
RE: Community Auth Learning... - by solidcodes - 08-19-2015, 02:04 AM
RE: Community Auth Learning... - by solidcodes - 08-20-2015, 06:24 PM
RE: Community Auth Learning... - by solidcodes - 08-20-2015, 06:32 PM
RE: Community Auth Learning... - by skunkbad - 08-20-2015, 07:41 PM
RE: Community Auth Learning... - by solidcodes - 08-20-2015, 09:10 PM
RE: Community Auth Learning... - by zenepay - 06-11-2016, 03:01 AM
RE: Community Auth Learning... - by bpuig - 05-17-2017, 08:33 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 02:53 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 02:56 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 04:07 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 04:38 AM
RE: Community Auth Learning... - by skunkbad - 08-21-2015, 02:05 PM
RE: Community Auth Learning... - by Narf - 08-21-2015, 02:11 PM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 04:50 AM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 05:04 AM
RE: Community Auth Learning... - by skunkbad - 08-21-2015, 02:07 PM
RE: Community Auth Learning... - by Narf - 08-21-2015, 02:13 PM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 04:38 PM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 07:08 PM
RE: Community Auth Learning... - by skunkbad - 08-21-2015, 09:23 PM
RE: Community Auth Learning... - by solidcodes - 08-21-2015, 10:04 PM
RE: Community Auth Learning... - by solidcodes - 11-14-2015, 07:34 PM
RE: Community Auth Learning... - by skunkbad - 11-15-2015, 12:05 AM
RE: Community Auth Learning... - by solidcodes - 11-15-2015, 03:43 AM
RE: Community Auth Learning... - by solidcodes - 11-15-2015, 08:15 PM
RE: Community Auth Learning... - by skunkbad - 11-16-2015, 01:04 PM
RE: Community Auth Learning... - by solidcodes - 11-17-2015, 07:57 PM
RE: Community Auth Learning... - by skunkbad - 11-18-2015, 10:42 AM
RE: Community Auth Learning... - by solidcodes - 11-18-2015, 06:46 PM
RE: Community Auth Learning... - by skunkbad - 11-18-2015, 07:25 PM
RE: Community Auth Learning... - by solidcodes - 11-18-2015, 07:38 PM
RE: Community Auth Learning... - by solidcodes - 11-23-2015, 03:55 PM
RE: Community Auth Learning... - by solidcodes - 11-23-2015, 11:25 PM
RE: Community Auth Learning... - by solidcodes - 11-24-2015, 12:29 AM
RE: Community Auth Learning... - by skunkbad - 11-24-2015, 01:01 PM
RE: Community Auth Learning... - by solidcodes - 11-24-2015, 06:15 PM
RE: Community Auth Learning... - by solidcodes - 11-28-2015, 04:45 PM
RE: Community Auth Learning... - by skunkbad - 11-29-2015, 02:31 AM
RE: Community Auth Learning... - by solidcodes - 11-29-2015, 02:43 AM
RE: Community Auth Learning... - by skunkbad - 11-29-2015, 09:52 AM
RE: Community Auth Learning... - by solidcodes - 11-30-2015, 05:24 PM
RE: Community Auth Learning... - by solidcodes - 11-30-2015, 05:28 PM
RE: Community Auth Learning... - by skunkbad - 11-30-2015, 06:32 PM
RE: Community Auth Learning... - by solidcodes - 11-30-2015, 07:33 PM
RE: Community Auth Learning... - by skunkbad - 12-01-2015, 01:22 AM
RE: Community Auth Learning... - by solidcodes - 11-30-2015, 07:52 PM
RE: Community Auth Learning... - by solidcodes - 12-01-2015, 03:20 PM
RE: Community Auth Learning... - by solidcodes - 12-01-2015, 03:48 PM
RE: Community Auth Learning... - by solidcodes - 12-01-2015, 06:35 PM
RE: Community Auth Learning... - by skunkbad - 12-01-2015, 11:24 PM
RE: Community Auth Learning... - by solidcodes - 12-02-2015, 04:46 PM
RE: Community Auth Learning... - by solidcodes - 12-05-2015, 04:33 PM
RE: Community Auth Learning... - by skunkbad - 12-05-2015, 08:37 PM
RE: Community Auth Learning... - by solidcodes - 12-08-2015, 05:03 PM
RE: Community Auth Learning... - by skunkbad - 12-08-2015, 08:12 PM
RE: Community Auth Learning... - by solidcodes - 12-09-2015, 06:14 PM
RE: Community Auth Learning... - by skunkbad - 12-09-2015, 09:03 PM
RE: Community Auth Learning... - by solidcodes - 12-10-2015, 02:31 PM
RE: Community Auth Learning... - by skunkbad - 12-10-2015, 04:51 PM
RE: Community Auth Learning... - by solidcodes - 12-10-2015, 05:36 PM
RE: Community Auth Learning... - by InsiteFX - 05-17-2017, 10:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB