Welcome Guest, Not a member yet? Register   Sign In
Community Auth - problem
#7

(10-25-2015, 01:33 AM)Martin7483 Wrote: @skunkbad
No need to go insulting me. I admit I misunderstood the question, as I did not take notice of the fact that it was a rule for a route being set.

As for not knowing how PHP works. Take the following which could be typos in any code:

PHP Code:
$variable some_value;

$array = array();
$array[some_key] = some_value_2

some_value, some_key and some_value_2 are not constants I need, but a simple typo which give these PHP errors
Notice: Use of undefined constant some_value - assumed 'some_value'
Notice: Use of undefined constant some_key - assumed 'some_key'
Notice: Use of undefined constant some_value_2 - assumed 'some_value_2'

Sorry, I wasn't trying to insult you.

I'll explain LOGIN_PAGE, so you can understand why it must be a constant, and what a constant is appropriate in this case.

If you dig around in Community Auth you would find that the routes.php file sets a special route to the main login page, and yes the key is the LOGIN_PAGE constant, which is declared in a pre-system hook. This is necessary because no CI config is available at that point. The idea here is that LOGIN_PAGE can be anything you want. On your site, if you want everyone to login at /rainbows/unicorns, then you just set the value of LOGIN_PAGE to /rainbows/unicorns. If you try to access /examples/login directly, you get a 404, which is intended, because I want to force people to use /rainbows/unicorns. Why this? Well, sometimes bots will hammer away on certain login pages; most people are familiar with wp-login.php getting hammered (if they are WordPress users). So now if /rainbows/unicorns is getting hammered on, just switch it to something else, like /stooges/3, or anything new.

I got the idea to make this part of Community Auth because of WordPress, and attacks on the login, which were a problem for me and many of my clients. This doesn't really help when the login is visible to anybody, but for many sites where the login is an unknown URL (except to staff members or admin users), then this can be quite handy. I'm sure you can think of other reasons why changing the login page URL would be handy.

So yes, LOGIN_PAGE is a constant, and must be a constant because it is declared in a pre-system hook and used in routing config, where CI config is not yet available.
Reply


Messages In This Thread
Community Auth - problem - by MartinMIB - 10-22-2015, 01:52 PM
RE: Community Auth - problem - by Martin7483 - 10-23-2015, 01:40 AM
RE: Community Auth - problem - by skunkbad - 10-23-2015, 05:48 PM
RE: Community Auth - problem - by Martin7483 - 10-24-2015, 10:02 AM
RE: Community Auth - problem - by skunkbad - 10-24-2015, 11:56 PM
RE: Community Auth - problem - by Martin7483 - 10-25-2015, 01:33 AM
RE: Community Auth - problem - by skunkbad - 10-25-2015, 04:48 PM
RE: Community Auth - problem - by syerwin - 02-27-2016, 11:12 AM
RE: Community Auth - problem - by syerwin - 02-27-2016, 11:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB