othAuth issue, believe begins with auto_redirect
Hello, I am implementing othAuth and run into issues when using $auto_redirect = true; please note that after each test, I clear cache and cookies, then test again. 1st situation: $auto_redirect = true with proper credentials, can login in fine at user/login and directs to correct page (without throws correct error), try to go to exhibitors/vip/add, get directed to user/login?from=/exhibitor/vip/ addi put in credentials, and it reloads same login page, clear cache and cookies, still same result 2nd situation: $auto_redirect = false same credentials just throws the login error I have posted all relevant(i think) code below, i have checked and double checked the permissions, I know they are correct. i use routes to direct exhibitor/vip/add to use exhibitor/v_add Thanks much for any light shed [code] class ExhibitorController extends AppController { var $name = 'Exhibitor'; var $helpers = array('Html', 'Form', 'othAuth'); var $components = array('othAuth'); var $uses = array('Exhibitor', 'Exhibitoruser', 'Vip', 'Personnel', 'User', 'Country', 'State', 'Occupation'); var $othAuthRestrictions = array( 'v_add','v_edit','v_delete'); var $eU = array(); /*- @beforeFilter() is used to load the information that all functions will want access to... namely, who the user is and what permissions the user has */ function beforeFilter() { $auth_conf = array( 'mode' => 'oth', 'login_page' => '/user/login', 'logout_page' => '/user/logout', 'access_page' => '/exhibitor', 'hashkey' => 'tRUCkinGsHoWLouISVillE', 'noaccess_page' => '/user/login', 'strict_gid_check' => false); $this->othAuth->controller = &$this; $this->othAuth->init($auth_conf); $this->othAuth->check(); [/code] [code] class UserController extends AppController { var $name = 'User'; var $helpers = array('Html', 'Form', 'othAuth'); var $components = array('othAuth'); /*--- before anything happens --*/ function beforeFilter() { $auth_conf = array( 'mode' => 'oth', 'login_page' => '/user/login', 'logout_page' => '/user/logout', 'access_page' => '/exhibitor', 'hashkey' => 'tRUCkinGsHoWLouISVillE', 'noaccess_page' => '/admin/noaccess', 'strict_gid_check' => false); $this->othAuth->controller = &$this; $this->othAuth->init($auth_conf); $this->othAuth->check(); . . . . . function login() { if(isset($this->params['data'])) { $auth_num = $this->othAuth->login($this->params['data'] ['User']); $this->set('auth_msg', $this->othAuth->getMsg($auth_num)); if(!$this->othAuth->user(null)) { $this->Session->setFlash('Invalid Username and Password combination'); $this->redirect('/user/login'); exit(); } else //we have a successful login { } } } [/code] [code] var $user_table_login = 'username'; var $user_table_passw = 'passwd'; var $user_table_gid= 'group_id'; var $user_table_active = 'active'; var $user_table_last_visit = 'last_visit'; var $auth_url_redirect_var = 'from'; var $show_auth_url_redirect_var = true; // decorate the url or not var $user_model = 'User'; var $group_model = 'Group'; var $permission_model = 'Permission'; var $history_active = false; var $history_model= 'UserHistory'; /* * Internals you don't normally need to edit those */ var $components= array('Session','RequestHandler'); var $controller= true; var $gid = 1; var $redirect_page = '/user/login'; var $hashkey = "tRUCkinGsHoWLouISVillE"; var $auto_redirect = true; var $login_page= '/user/login'; var $logout_page = ''; var $access_page = '/user/login'; var $noaccess_page = '/user/login'; // session_flash, flash, back or a page url [/code] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For
Re: othAuth Issue
Thanks uic, I'll give that a shot this afternoon and let you know what I find out. i would try to check at some point in the component what part of the process is failing. first i would try to print session variables after connecting to the database in login function : $this->Session->write($this->sesskey, $sessdata); //---> just here, before it returs true and try to redirect try to print_r($_SESSION);exit; //if the model connected correctly to the database amd took everything, //the function should have stored everything in the session variables. return true; if you can see the user group...the user is authenticated and stored in your session what comes after is the reload action in the users controller, you can try also there before redirecting to print_r($_SESSION);exit; to check if the data still there in your session..if it does then you have the same problem i run into this morning...the session data is lost after this redirect..and im still trying to solve this...maybe we can find something :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: othAuth Issue
i would try to check at some point in the component what part of the process is failing. first i would try to print session variables after connecting to the database in login function : $this->Session->write($this->sesskey, $sessdata); //---> just here, before it returs true and try to redirect try to print_r($_SESSION);exit; //if the model connected correctly to the database amd took everything, //the function should have stored everything in the session variables. return true; if you can see the user group...the user is authenticated and stored in your session what comes after is the reload action in the users controller, you can try also there before redirecting to print_r($_SESSION);exit; to check if the data still there in your session..if it does then you have the same problem i run into this morning...the session data is lost after this redirect..and im still trying to solve this...maybe we can find something :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: othAuth Issue
Hello uic, Thanks for your reply. If I understand you correctly, I have made models for "user", & "group". user: array('className'=> 'Group', 'foreignKey' => 'group_id')); } ?> group: array('className' => 'Permission', 'joinTable' => 'groups_permissions')); } ?> I've created group levels 100, 200, 300. Assigned groups names per tutorial 0.5 Created permissions (1,1) (2,2) (2,3) (2,4) (3,5) (3,6) etc. var $mode = 'oth'; var $gid = 3; var $auto_redirect = true; var $gid_order = 'asc'; var $strict_gid_check = false; I have access to everything I'm trying to protect. Tested in all levels 100, 200, 300. Ideas? Many thanks for your help. devon I'm using component 0.5.2 and was referring to the 0.5 tutorial. Have attempted to use the correct conventions. Where I left off yesterday was basically where I'm at today. On Dec 21, 9:15 am, ":uic" <[EMAIL PROTECTED]> wrote: Hi devon, looks like your user data is not being passed to the session...thats why when the lock function is trying to determine wheter the user is authorized or not its not able to find this data in the session. Have you made the models and its relationships? (usermodel and groupmodel) devon wrote: > Hello CakePHP Community.. > I'm new to the framework and excited to get some work done for my > clients. It looks to be a very good framework with improving > documentation. On to my issue.. > Traversing through this group and on IRC I know this topic has come up > many times, but I must ask for an assist. I've downloaded and installed > onAuth component 05.2, the helper, baked the models, set up the db > permissions matrix, updated the appController, and have followed the > tutorial closely. ( I thought) > I'm having a problem enabling login. I am not getting beyond the login > page, however I can open the admin views of the content I am trying to > secure. > I do get an "Invalid ID for User" when accessing users/index. No other > errors are thrown. This must be a simple fix, but I'm not able to find > the problem. What am I missing? > Devon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: othAuth Issue
Hi devon, looks like your user data is not being passed to the session...thats why when the lock function is trying to determine wheter the user is authorized or not its not able to find this data in the session. Have you made the models and its relationships? (usermodel and groupmodel) devon wrote: Hello CakePHP Community.. I'm new to the framework and excited to get some work done for my clients. It looks to be a very good framework with improving documentation. On to my issue.. Traversing through this group and on IRC I know this topic has come up many times, but I must ask for an assist. I've downloaded and installed onAuth component 05.2, the helper, baked the models, set up the db permissions matrix, updated the appController, and have followed the tutorial closely. ( I thought) I'm having a problem enabling login. I am not getting beyond the login page, however I can open the admin views of the content I am trying to secure. I do get an "Invalid ID for User" when accessing users/index. No other errors are thrown. This must be a simple fix, but I'm not able to find the problem. What am I missing? Devon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
othAuth Issue
Hello CakePHP Community.. I'm new to the framework and excited to get some work done for my clients. It looks to be a very good framework with improving documentation. On to my issue.. Traversing through this group and on IRC I know this topic has come up many times, but I must ask for an assist. I've downloaded and installed onAuth component 05.2, the helper, baked the models, set up the db permissions matrix, updated the appController, and have followed the tutorial closely. ( I thought) I'm having a problem enabling login. I am not getting beyond the login page, however I can open the admin views of the content I am trying to secure. I do get an "Invalid ID for User" when accessing users/index. No other errors are thrown. This must be a simple fix, but I'm not able to find the problem. What am I missing? Devon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---