Warning: Illegal string offset '_imagedir' in /home/cakephpf/public_html/lofiversion/index.php on line 545

Warning: Illegal string offset '_emodir' in /home/cakephpf/public_html/lofiversion/index.php on line 546
CakePHP UnOfficial Community Forum > validating login data fails because of md5
Help - Search - Member List - Calendar
Full Version: validating login data fails because of md5
CakePHP UnOfficial Community Forum > Cake Components


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


$user = $this->User->find(array('email' => $this->data['User']['email'], 'password' => md5($this->data['User']['password'])), array('id', 'email'));
           if(empty($user) == false)

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:


SELECT `User`.`id`, `User`.`email` FROM `users` AS `User` WHERE `email` = 'test@web.de' AND `password` = 'd41d8cd98f00b204e9800998ecf8427e' LIMIT 1

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


<div class="">
   <?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(); ?>
I think I have the same problem... Anyone knows any solution?
The md5 value being display is for an empty string.

I would begin by debugging your $this->data because it sounds like it is not being set properly.

Another question, why not just use the Auth component to do this? You can follow my simple tutorial here to set it up in less than 10 minutes: CakePHP Login System
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2015 Invision Power Services, Inc.
Lo-Fi 1.1 iDS Beta, Originally written by Matt,
re-written by Shaun Harrison, Layer 04.com, for pre IPB2.0 versions.