So are you not using the Auth helper? It takes care of these things for you as long as you follow naming conventions or specify the user table and the username and password columns in that table.
On Jun 20, 5:20 am, Tomfox Wiranata <[email protected]> wrote: > hi, > > i have a problem. i am saving the users password at registration as > md5. > when the user is trying a login, i check if the entered username and > password is equal to the entry in the database. for that, i have to > convert the entered password into md5, to make it comparable: > > thats the code to find the user in my controller class > > [CODE] > $user = $this->User->find(array('email' => $this->data['User'] > ['email'], 'password' => md5($this->data['User']['password'])), > array('id', 'email')); > if(empty($user) == false) > [/CODE] > > now if print the query to check what it looks like, one thing is odd. > no matter what password i enter it is ALWAYS(!) the same md5 key: > > [CODE] > SELECT `User`.`id`, `User`.`email` FROM `users` AS `User` WHERE > `email` = '[email protected]' AND `password` = > 'd41d8cd98f00b204e9800998ecf8427e' LIMIT 1 > [/CODE] > > no wonder i get no results and the variable "$user" is empty...i get > "d41d8cd98f00b204e9800998ecf8427e" everytime.. > > thats a mystery....does somebody know the answer? i'd be soooo happy > > many many thanks > > btw: thats my view > > [CODE] > <div class=""> > <h2>Login</h2> > <?php echo $form->create('User', array('action' => 'login'));?> > <?php echo $form->input('email');?> > <?php echo $form->input('password');?> > <?php echo $form->submit('Login');?> > <?php echo $form->end(); ?> > </div> [/CODE] 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 [email protected] 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
