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

(This post was last modified: 11-14-2015, 07:37 PM by solidcodes.)

Okay I open the login_form.php
and it has this codes below,

Code:
    echo form_open( $login_url, array( 'class' => 'std-form' ) );

Now I echo $login_url to know where it will submit the data and the login method, but I got this URL below,
http://localhost/ci/ci3-community-auth/login?redirect=

the question is what is the segments URL mean? /login?redirect=
what exact method it is calling inside the examples.php controller?

Can someone shade some light please.

Thanks in advance.
Reply
#22

(11-14-2015, 07:34 PM)solidcodes Wrote: Okay I open the login_form.php
and it has this codes below,

Code:
    echo form_open( $login_url, array( 'class' => 'std-form' ) );

Now I echo $login_url to know where it will submit the data and the login method, but I got this URL below,
http://localhost/ci/ci3-community-auth/login?redirect=

the question is what is the segments URL mean? /login?redirect=
what exact method it is calling inside the examples.php controller?

Can someone shade some light please.

Thanks in advance.

Look at your routes. By default, Community Auth has a route that masks the actual controller/method used to login.
PHP Code:
$route[LOGIN_PAGE] = 'examples/login'

AND the LOGIN_PAGE constant is defined in application/hooks/auth_constants.php


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

So what this means is that somebody would think that you have a login controller, yes? No. You are masking the true controller/method, which is located at examples/login.

By the way, if you try to access examples/login directly, it should give you a 404.

Why this masking? This feature was implemented at a time when I had some WordPress sites that were getting hammered by brute force attacks. The host recommended changing the login URL, and so this concept was born. Community Auth allows you to change the login URL (as well as make supplemental login URLs), and change them anytime you want, to anything you want. Imagine "/log/in/to/my/website", or anything you wish.
Reply
#23

+1 for sharing community-auth
Reply
#24

(This post was last modified: 11-15-2015, 09:13 PM by solidcodes.)

Is this codes necessary in route?
Code:
$route[LOGIN_PAGE] = 'examples/login';

What is the purpose of this login_page route?
Or can I remove it and could the auth will still work without it?

still digging the code and figuring out why it's not logging -in
Reply
#25

(11-15-2015, 08:15 PM)solidcodes Wrote: Is this codes necessary in route?
Code:
$route[LOGIN_PAGE] = 'examples/login';

What is the purpose of this login_page route?
Or can I remove it and could the auth will still work without it?

still digging the code and figuring out why it's not logging -in

Yes, this is necessary, as explained in my last post. If you're just testing out Community Auth with the example controller, and if you created a user, then you might not be able to log in unless the user was created with user level 9.
Reply
#26

(This post was last modified: 11-17-2015, 08:03 PM by solidcodes.)

Its not easy to dig someone else codes.
the good thing it has documentation and example.
I customize the login form.

the error log is very helpful
thank you for making that skunkbad

Finally I can now login.
Reply
#27

(11-17-2015, 07:57 PM)solidcodes Wrote: Its not easy to dig someone else codes.
the good thing it has documentation and example.
I customize the login form.

the error log is very helpful
thank you for making that skunkbad

Finally I can now login.

Good. What was the problem?
Reply
#28

(This post was last modified: 11-18-2015, 06:48 PM by solidcodes.)

It was an easy fix.
I forgot to copy this code below
Code:
$this->setup_login_form();

By the way I have question.
Am I allowed to create one login form only?
Because let say I want to create login form for public page and another login form for administrator (/admin/login).

thanks in advance.
Reply
#29

(11-18-2015, 06:46 PM)solidcodes Wrote: It was an easy fix.
I forgot to copy this code below
Code:
       $this->setup_login_form();

By the way I have question.
Am I allowed to create one login form only?
Because let say I want to create login form for public page and another login form for administrator (/admin/login).

thanks in advance.

You can absolutely create extra login pages. All you need to do is add the page to the allowed_pages_for_login array, located in config/authentication.php.


PHP Code:
$config['allowed_pages_for_login'] = array(
    'admin/login'
); 

Your new login form would point to itself.

For some info that is somewhat related to this, check the "Optional Login" page on the Community Auth website:

http://community-auth.com/documentation/...entication
Reply
#30

another +1 for always answering my question.

thanks very helpful...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB