Welcome Guest, Not a member yet? Register   Sign In
Community Auth problem with login
#2

(This post was last modified: 02-29-2016, 02:02 PM by skunkbad.)

First, if you are changing your login page from "/login" to "/welcome/index", all you need to do is change the LOGIN_PAGE constant in auth_constants.php:

Code:
define('LOGIN_PAGE', 'welcome');

This would mean that if somebody goes to the welcome URI, aka welcome/index, then they would be presented with the login page.

If instead you want to use "/login" as your URI, and you want the welcome/index to handle the login page, just copy/modify the login method that comes inside controllers/Examples.php. Something like this:

Code:
public function index()
{
   // Method should not be directly accessible
   if( $this->uri->uri_string() == 'welcome')
       show_404();

   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;
}

// --------------------------------------------------------------


That is just the login page, not a page for anything else. If you want an additional login page, then you must add that URI string to $config['allowed_pages_for_login'], but you haven't done that correctly, and I'm not sure what exactly you are trying to do.

You have a welcome/login method, so it sounds like what you really wanted to do is change the LOGIN_PAGE constant to "welcome/login".

Yes, you are for sure only going to be able to login as admin if your code is the way it is. Instead, you might try this:

Code:
if( $this->require_role('admin,ag,an') )
{
    $this->load->view( $this->auth_role . '_dashboard' );
}
Make sure to look at the Examples controller. It's there to provide you with some essential clues as to how Community Auth works. Also, this page: http://community-auth.com/documentation/...entication
Reply


Messages In This Thread
Community Auth problem with login - by yettie - 02-29-2016, 10:51 AM
RE: Community Auth problem with login - by skunkbad - 02-29-2016, 02:00 PM
RE: Community Auth problem with login - by yettie - 03-02-2016, 08:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB