Thursday, April 29, 2010

Re: I have a problem when i am creating user login authentication

Its currently running project, thats why are not at all do any changes in the database table.
I have to use the same table only, i have no right to change the table, is their any way please help me out
On Thu, Apr 29, 2010 at 12:48 PM, Andrei Mita <andrei.mita@gmail.com> wrote:
I believe your table should be pluralized: users

Also, why do you use tbl before you table names?



On Thu, Apr 29, 2010 at 10:11 AM, Narendra Padala <crazycakephp@gmail.com> wrote:


Hi..Every one ,
i am using postgresql database for cake when i am creating the user
authentication its show errors,
hope u i wrote properly but it shows Error, i wrote code like this
please any one can help me out.


My Database Table Name "tbluser "
------------------------------------------


    Columns    |          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

class Tbluser extends AppModel {

   var $useTable = 'tbluser';

}


----------------------------------------------

Controller:tblusers_controller.php


class TblusersController extends AppController {

   var $name = "Tblusers";

   function login() {

   }

   function index() {

   }
   function logout() {

       $this->Session->setFlash('Logout');

       $this->redirect($this->Auth->logout());
   }
}

------------------------------------------------------
App Controller :app_controller.php


class AppController extends Controller {

   var $uses=array('Tbluser');

   var $components = array('Auth');

   function beforeFilter(){
       $this->Auth->loginRedirect = array('controller'=> 'tblusers',
                                          'action' => 'index');
       $this->Auth->logoutRedirect = array('controller'=> 'tblusers',
                                           'action' => 'login');

       $this->Auth->allow('login');

       $this->Auth->authorize = 'controller';

       $this->set('loggedIn', $this->Auth->Tbluser('lnguser')); //
Here I am getting the error
   }

   function isAuthorized() {
       return true;
   }
}

--------------------------------------------------------
viewfile : login.ctp

            <?php echo $form->create('Tbluser',
                                     array(
                                     'action' => 'login'));
            ?>
                       <table border="0" cellspacing="0"
cellpadding="0">
                           <tr>
                               <td align="center"
valign="middle">USERNAME</td>
                               <td align="center" valign="middle"></
td>
                               <td align="center" valign="middle">
                                   <?php
                                        e($form->text('struid'));
                                   ?>
                               </td>
                               <td>&nbsp;</td>
                           </tr>
                           <tr>
                               <td>&nbsp;</td>
                               <td>&nbsp;</td>
                               <td>&nbsp;</td>
                               <td>&nbsp;</td>
                           </tr>
                           <tr>
                               <td align="center"
valign="middle">PASSWORD</td>
                               <td align="center" valign="middle"></
td>
                               <td align="center" valign="middle">
                                   <?php
                                       echo $form-
>password('strpid');
                                   ?>
                               </td>
                               <td>&nbsp;</td>
                           </tr>
                           <tr>
                               <td>&nbsp;</td>
                               <td>&nbsp;</td>
                               <td>&nbsp;</td>
                               <td>&nbsp;</td>
                           </tr>
                       </table>

                       <?php
                                         echo $form-
>submit('signin.gif',array(
                                                            'onclick'
=> 'validate()'));

                       ?>

                       <?php echo $form->end(); ?>

---------------------------------------------------------
Fatal error: Call to undefined method AuthComponent::tbluser() in /
home/narendra/wizard_mvc/app/app_controller.php


Please help me out.....! Thanks in advance

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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: