I think this piece of the guide will help: 
http://book.cakephp.org/view/1265/AuthComponent-Variables#authorize-1275

Try adding: $this->Auth->authorize = 'controller'; to your app_controller's 
beforeFilter.

Jeremy Burns
jeremybu...@me.com


On 8 Jun 2010, at 07:50, Narendra Padala wrote:

> its not at all showing the index page, its back to the login page only
> in the debugger no wuery also executed
> 
> 
> On Tue, Jun 8, 2010 at 12:07 PM, Jeremy Burns <jeremybu...@me.com> wrote:
> What errors are you getting?
> 
> Jeremy Burns
> jeremybu...@me.com
> 
> 
> On 8 Jun 2010, at 07:28, Narendra Padala wrote:
> 
>> Hi am new to cakephp, i am using postgress sql database this is an existing 
>> database here i am not having permissions to change any thing in database. 
>> but i have to wrote user authentication using app_controller.php
>> so tried to wrote code like this but it was not working properly please any 
>> one can help me out to solve this problem.
>> 
>> 
>> ---------------------
>> Database table: 
>> ---------------------
>> table name: tbluser
>> ---------------------
>> 
>> 
>>      Column     |          Type          |                              
>> Modifiers                              
>> ----------------+------------------------+---------------------------------------------------------------------
>>  lnguser        | integer                | not null default 
>> nextval(('"tbluser_lnguser_seq"'::text)::regclass)
>>  strfname       | character varying(100) | not null
>>  strlname       | character varying(100) | not null
>>  struid         | character varying(100) | not null
>>  strpid         | character varying(100) | not null
>>  lnguser_group  | integer                | not null
>>  strtelarea     | character varying(20)  | 
>>  strtelno       | character varying(20)  | 
>>  stremail       | character varying(100) | 
>>  struserconfirm | character varying(100) | 
>>  dtmregistered  | date                   | 
>>  dtmapproved    | date                   | 
>>  blnchatuser    | bit(1)                 | 
>> Indexes:
>>     "tbluser_pkey" PRIMARY KEY, btree (lnguser)
>> 
>> 
>> --------------------
>> Model : tbluser.php
>> --------------------
>> <?php  
>> 
>> class Tbluser extends AppModel { 
>> 
>>     var $useTable = 'tbluser'; 
>> } 
>> ?>
>> 
>> 
>> 
>> -------------------------------------
>> Controller : tblusers_controller.php
>> -------------------------------------
>> <?php
>> 
>> class TblusersController extends AppController {
>> 
>>     var $name = "Tblusers";
>> 
>>     var $uses = array('Tbluser');
>> 
>>     var $helpers = array('Html', 'Form');
>> 
>>     function login() {
>> 
>>     }
>> 
>>     function index() {
>> 
>>     }
>>     function logout() {
>> 
>>         $this->Session->setFlash('Successfully logout');
>> 
>>         $this->redirect($this->Auth->logout());
>>     }
>> 
>> 
>> }
>> 
>> ?>
>> 
>> 
>> -----------------------
>> Login page : login.ctp
>> -----------------------
>> 
>>     <?php
>>         if ($session->check('Message.auth')) {
>>                $session->flash('auth');
>>         }
>>         if ($form->isFieldError('User.username')) {
>>             e($form->error ('User.username', null));
>>         }
>>     ?>
>> 
>>     <!-- login form start -->
>>     <table width="80%" cellpadding="0" cellspacing="0" border="0">
>>         <?php e($form->create('Tbluser',array('action' => 'login'))); ?>    
>>         <tr>
>>             <td width="10%"> &nbsp;</td>
>>             <td width="20%"> Username&nbsp;</td>
>>             <td width="20%"> <?php e($form->text('struid')); ?> </td>
>>             <td width="30%"> &nbsp;</td>
>> 
>>         </tr>
>>         <tr>
>>             <td width="10%"> &nbsp;</td>
>>             <td width="20%"> Password&nbsp;</td>
>>             <td width="20%"> <?php e($form->password('strpid')); ?> </td>
>>             <td width="30%"> &nbsp;</td>
>> 
>>         </tr>
>>         <tr>
>>             <td width="10%"> &nbsp;</td>
>>             <td width="20%"> &nbsp;</td>
>>             <td width="20%"><?php e($form->submit('Login')); ?></td>
>>             <td width="30%"> &nbsp;</td>
>>         </tr>
>>         <?php e($form->end()); ?>
>>     </table>
>>     <!-- login form end -->
>> 
>> 
>> 
>> -----------------------
>> index page : login.ctp
>> -----------------------
>> <?php
>>     echo "Welcome cakephp world ...!";
>> ?>
>> 
>> 
>> 
>> 
>> ------------------------------------
>> App Controller : app_controller.php
>> ------------------------------------
>> 
>> <?php
>> 
>> class AppController extends Controller {
>> {
>>     var $components = array('Auth', 'RequestHandler');
>> 
>>     var $uses = array ('Tbluser') ; 
>> 
>>     var $helpers = array('Javascript','Html','Form','Ajax');
>> 
>>     function beforeFilter(){
>> 
>>         $this->Auth->allow('adduser');
>> 
>>         $struid = $this->Auth->user('struid');
>> 
>>         $id = $this->Auth->user('lnguser');
>> 
>>         $this -> Session -> write('struid', $struid);
>> 
>>         $this -> Session -> write('id', $id);
>> 
>>         $this->set('struid', $this->Auth->user('struid'));
>> 
>>         $this->set('userId', $this->Auth->user('lnguser'));
>> 
>>         $this->Auth->loginRedirect = array('controller' => 'tblusers', 
>> 'action' => 'index');
>> 
>>     }    
>> 
>>     function isAuthorized() {
>> 
>>          return true;
>> 
>>      }
>> 
>> }
>> 
>> ?>
>> --------------------------------
>> 
>> please any one can help me out...here i attached the copy code as text file.
>> 
>> 
>> 
>> Check out the new CakePHP Questions site http://cakeqs.org and help others 
>> with their CakePHP related questions.
>>  
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
>> http://groups.google.com/group/cake-php?hl=en
>> <user_auth.php>
> 
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>  
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
> 
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>  
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to