Welcome Guest, Not a member yet? Register   Sign In
Community Auth Redirect
#1

Hi, after testing and trying out with this awesome community auth library, I come across an issue. 

$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route[LOGIN_PAGE] = 'login/index';


I have a default controller home which is just a static web page for the public.
I have a login page which is login/index
I have an admin page which is admin/index

Every time i login from login/index, i will be redirected to home controller which is the default behavior.
I need it to redirect to admin/index. At the same time, i need all visitor to my site to land on home/index when 
they visit the domain eg. www.mywebsite.com

After trying and testing for one week, I am still unable to change the login to redirect to admin/index and at
the same time keeping my visitor landing on home/index.

Any advice will be deeply appreciated! Thanks in advance!
Reply
#2

http://community-auth.com/documentation/...cation-php

You could change the default login redirect to "admin".

You can also alter the query string for the login attempt to include redirect=admin, but that's doing it the hard way.
Reply
#3

(04-16-2016, 07:59 AM)skunkbad Wrote: http://community-auth.com/documentation/...cation-php

You could change the default login redirect to "admin".

You can also alter the query string for the login attempt to include redirect=admin, but that's doing it the hard way.

Thank you skundbad.
Reply
#4

Hi Skunkbad,
I wonder that the function $this->require_min_level(1) will just return true/false or it redirect to login page if false.
I am trying to initial create new user with auth_level =0, then after email verifying is confirmed, it will set auth_level =1.
But I found that just after register new account, it will redirect to page /login. I tried to look for where I could prevent this. So, I can return message telling new register to check email etc.
Please advise.
Reply
#5

(06-07-2016, 11:10 PM)zenepay Wrote: Hi Skunkbad,
I wonder that the function $this->require_min_level(1) will just return true/false or it redirect to login page if false.
I am trying to initial create new user with auth_level =0, then after email verifying is confirmed, it will set auth_level =1.
But I found that just after register new account, it will redirect to page /login. I tried to look for where I could prevent this. So, I can return message telling new register to check email etc.
Please advise.

The redirect should only happen if you are not logged in. But there are some problems with what you are doing. I don't think you can create a user level 0, and a better solution would be to set `users`.`banned` to 1, then after they verify their account set it to 0.

In my own personal websites, and the websites I create for customers, users who are going through the verification process are stored in a different table than regular users. This table has a field for a registration code, and the code is a query string parameter that must be in the verification URL. If the user follows the link that is in their email, their temporary account is used to create a real user account, and then the temporary account is deleted.

Since you asked, the method verify_min_level is like require_min_level, except without the redirect.
Reply
#6

(06-08-2016, 12:33 AM)skunkbad Wrote:
(06-07-2016, 11:10 PM)zenepay Wrote: Hi Skunkbad,
I wonder that the function $this->require_min_level(1) will just return true/false or it redirect to login page if false.
I am trying to initial create new user with auth_level =0, then after email verifying is confirmed, it will set auth_level =1.
But I found that just after register new account, it will redirect to page /login. I tried to look for where I could prevent this. So, I can return message telling new register to check email etc.
Please advise.

The redirect should only happen if you are not logged in. But there are some problems with what you are doing. I don't think you can create a user level 0, and a better solution would be to set `users`.`banned` to 1, then after they verify their account set it to 0.

In my own personal websites, and the websites I create for customers, users who are going through the verification process are stored in a different table than regular users. This table has a field for a registration code, and the code is a query string parameter that must be in the verification URL. If the user follows the link that is in their email, their temporary account is used to create a real user account, and then the temporary account is deleted.

Since you asked, the method verify_min_level is like require_min_level, except without the redirect.

Hi Skunkbad,
Thank you for your valuable response. Now, I could get it worked.
I have thought for a while if I should do register with users table using Communication Auth as a core controller.
Yes, I design to put it there, just to make it simple. So, creating account and login will do in Auth class.
I add email_verfication_code field to users table.
Then after email verification is done, it starts to create user Profile which is in different table eg. Members where more detail of members are saved to.

Thank you for your great support.
Reply
#7

Glad I could help. 1:13AM here, so I'm going to sleep!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB