CodeIgniter Forums
Community Auth issues - Any help would be appreciated - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7)
+--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13)
+--- Thread: Community Auth issues - Any help would be appreciated (/showthread.php?tid=66572)

Pages: 1 2


Community Auth issues - Any help would be appreciated - revelnode - 11-06-2016

Hello,

I am starting a project, and I have run into a bit of a snag with Community Auth.

System Specs:

CentOS 7
mysql  Ver 15.1 Distrib 5.5.50-MariaDB, for Linux (x86_64) using readline 5.1
PHP 5.6.27 (cli) (built: Oct 15 2016 20:57:37)
Copyright © 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright © 1998-2016 Zend Technologies
nginx version: nginx/1.10.1

First think I noticed was that it kept telling me that LOGIN_PAGE and USE_SSL in almost every function should have ' ' aroound it.  This happened for almost every login step. 

A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant USE_SSL - assumed 'USE_SSL'
Filename: controllers/Examples.php
Line Number: 374

I "fixed" all these entried (should I have?) and I do not get any errors.

Next issue, when I creatd my user, it tells me my login was wrong, I use the reset password, and it works but when I go to simpla verification, it tells me no one is logged in. and it just refreshed the login page when I login.

My Database show severl auth sessions, but no ci_seesions (this normal?)

Not sure how to proceed.  Let me know if you reuire any more info into the issues I am having.  Huh 

Regards,
Revelnode


RE: Community Auth issues - Any help would be appreciated - revelnode - 11-06-2016

Just did the latest comit... Still had to put all the USE_SSL and LOGIN_PAGE referenced into ' '. but it works fine now.


RE: Community Auth issues - Any help would be appreciated - revelnode - 11-06-2016

On that note however, I would like to make admin 0 instead of 9... Or does it have to be atleast 1? The reason behind this is we do not know as of yet how many levels of auth we require, and I would like to have our "GOD" admin have the number 0 (like root)

Is it possible?


RE: Community Auth issues - Any help would be appreciated - skunkbad - 11-06-2016

(11-06-2016, 03:28 AM)revelnode Wrote: On that note however, I would like to make admin 0 instead of 9... Or does it have to be atleast 1?  The reason behind this is we do not know as of yet how many levels of auth we require, and I would like to have our "GOD" admin have the number 0 (like root)

Is it possible?

Actually, with Community Auth it's the exact opposite. Your "God" role would be as high of a number as you think you might need to accomodate all of your other roles, and that would never be 0 or 1. It's likely that you would want to choose something like 9 or 99 or 999 ....


RE: Community Auth issues - Any help would be appreciated - revelnode - 11-12-2016

I think I need to revisit my code, or something is wrong with my PHP... Out of the box this would work, however, I having issues...

For the login page in  auth_constants.php you say to use the following code:



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

And then in the routes.php file you say to add the following:

Code:
$route[LOGIN_PAGE] = 'examples/login';

This should allow you to log in at http://www.whatevermysiteis.com/login, however, for whatever reason, mine comes up with all those undefined constant errors and actually points me to http://www.whatevermysiteis.com/LOGIN_PAGE

Is there something I have to turn on in my PHP?  I am running CentOS 7 with PHP 5.6

NOTE: I have not re-installed this add-on yet.  I can't from work. My solution to get everything to work right was to go into every page and change every instance of "LOGIN_PAGE" to "login" and it worked, but I am not sure how this will break other features later on.  I will re-install tomorrow and see if I can figure out what's causing the errors and how NOT to modify the code in any absurd way.
 

Regards,
Koster


RE: Community Auth issues - Any help would be appreciated - skunkbad - 11-12-2016

(11-12-2016, 08:07 PM)revelnode Wrote: I think I need to revisit my code, or something is wrong with my PHP... Out of the box this would work, however, I having issues...

For the login page in  auth_constants.php you say to use the following code:



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

And then in the routes.php file you say to add the following:

Code:
$route[LOGIN_PAGE] = 'examples/login';

This should allow you to log in at http://www.whatevermysiteis.com/login, however, for whatever reason, mine comes up with all those undefined constant errors and actually points me to http://www.whatevermysiteis.com/LOGIN_PAGE

Is there something I have to turn on in my PHP?  I am running CentOS 7 with PHP 5.6

NOTE: I have not re-installed this add-on yet.  I can't from work. My solution to get everything to work right was to go into every page and change every instance of "LOGIN_PAGE" to "login" and it worked, but I am not sure how this will break other features later on.  I will re-install tomorrow and see if I can figure out what's causing the errors and how NOT to modify the code in any absurd way.
 

Regards,
Koster
It sounds like you don't have the hook configured to run pre-system.


RE: Community Auth issues - Any help would be appreciated - revelnode - 11-13-2016

Could you elaborate? I will reinstall following your install instructions and see if i can get it to work without errors... Maybe i missed something the first 2 times.

Also my system and application dorectories are outside the public folder (and routed properly via the configs) not sure if that makes a difference.

Regards
Koster


RE: Community Auth issues - Any help would be appreciated - skunkbad - 11-13-2016

In config/config you should have enabled hooks by setting it to TRUE. Also, in config/hooks you need:

PHP Code:
$hook['pre_system'] = array(
 
   'function' => 'auth_constants',
 
   'filename' => 'auth_constants.php',
 
   'filepath' => 'hooks'
);
$hook['post_system'] = array(
 
   'function' => 'auth_sess_check',
 
   'filename' => 'auth_sess_check.php',
 
   'filepath' => 'hooks'
); 



RE: Community Auth issues - Any help would be appreciated - revelnode - 11-13-2016

Ok that did the trick... use of hooks was set to False...

Thank you for the help... Great Product and great support.

Regards,
Koster


RE: Community Auth issues - Any help would be appreciated - skunkbad - 11-14-2016

(11-13-2016, 11:34 PM)revelnode Wrote: Ok that did the trick... use of hooks was set to False...

Thank you for the help... Great Product and great support.

Regards,
Koster

You're welcome. After a while the same problems come up for different people, so it's easy to help.