Just place it in bootstrap so all pages inherit it.

On Jan 11, 2:54 am, euromark <dereurom...@googlemail.com> wrote:
> as miles said
> best at the very top of your file
>
> <?php
> HERE
>
> On 11 Jan., 03:32, jmail <ad...@jmail.pl> wrote:
>
>
>
>
>
>
>
> > Hmmmm. That is strange. Why is that working on other controller for
> > admin?
>
> > Where should I put this App::uses? Can I put this somwhere in
> > AppController?
>
> > I have added that into the login function and now that is working.
>
> > jmail
>
> > On 11 Sty, 03:28, Miles J <mileswjohn...@gmail.com> wrote:
>
> > > Add this to the top:
>
> > > App::uses('Security', 'Utility');
>
> > > On Jan 10, 6:25 pm, jmail <ad...@jmail.pl> wrote:
>
> > > > Hi all!
>
> > > > I am preparing some login action in my app. I have made view
>
> > > > <%=$this->Form->create('User', array('action' =>
> > > > 'login','inputDefaults' => array('label' => false,'div' => false)));%>
> > > >                 <%=$this->Form->input('mail', array('type' => 'text', 
> > > > 'label' =>
> > > > 'Email:<br>'));%><br>
> > > >                 <%=$this->Form->input('pass', array('type' => 
> > > > 'password', 'label' =>
> > > > 'Pass:<br>'));%><br><br>
> > > >                 <%=$this->Form->end(array('value' => 'Login', 'label' 
> > > > => 'Login',
> > > > 'class' => 'searchsubmit',  'div' => array('class' => 'floatRight')));
> > > > %>
>
> > > > I have build function in UsersController
>
> > > > class UsersController extends AppController{
>
> > > >         public function login(){
> > > >                 if ($this->request->is('post')) {
> > > >             $user = 
> > > > $this->User->findByMailAndPass($this->request->data["User"]["mail"], 
> > > > Security::hash($this->request->data["User"]
>
> > > > ["pass"], null, true));
> > > >             if ($user === false) {
> > > >                 $this->Session->setFlash('Nieprawid³owe dane
> > > > logowania.');
> > > >                 $this->request->data["User"]["mail"] = '';
> > > >                 $this->request->data["User"]["pass"] = '';
> > > >             } else {
> > > >                 CakeSession::write('user.id', $user["User"]["id"]);
> > > >                 CakeSession::write('user.mail', $user["User"]
> > > > ["mail"]);
> > > >                 $this->redirect(array('controller' => 'users',
> > > > 'action' => 'profile'));
> > > >             }
> > > >         }
> > > >         }
>
> > > >         public function logout(){
> > > >         CakeSession::delete("user");
> > > >         $this->redirect('/');
> > > >         }
>
> > > > }
>
> > > > So. When I go to the HOST/users/login everything is ok, but when I try
> > > > to submit login form I get an error
>
> > > > Fatal error: Class 'Security' not found in
>
> > > > and of course I've got
>
> > > > var $helpers = array('Form', 'Html', 'Session', 'Cycle');
>
> > > > in AppController
>
> > > > Can anyone please help me what should I do?
>
> > > > Please do not tell me to change my login to the Cake model - I need
> > > > that this way done.
>
> > > > For end I will add info tha the same action is working good for admin
> > > > login :(
>
> > > > thank's for tips
>
> > > > regards
>
> > > > jmail- Ukryj cytowany tekst -
>
> > > - Poka¿ cytowany tekst -

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

Reply via email to