include 'echo $this->Session->flash();' in your layout.
On Wed, Apr 6, 2011 at 6:00 PM, MeatSandwich <[email protected] > wrote: > Hi Zaky, thanks very much for the response. Very kind to help me. > > 1. I have my login form and my register a new user form onthe same > page, ie views/pages/signup.ctp. The issue with having these two forms > on the same page is that they both use the user model. Therefore if a > user enters an invalid password for example, then an error message > will appear in the email field of BOTH forms rather than just the one > the users was actually using. According to a tutorial I found the way > round this is to make a new model which extends the User model and > call it when creating the form, ie <?php echo $this->Form- > >create('RegUser', array('url'=>array('controller'=>'users', > 'action'=>'add')));?> > > 2. I'll give this a go, thanks, not sure it'll work tho because I'm > pretty sure I've tried that already. > > 3. That code line by line goes: > --- check if there was a password field in the RegUser form > --- $logdetails is what I'll use as the login details because I'm > about to hash the password manually because Auth component wont hash > automatically unless the fileds and table names are it's default (I > managed to change the field names to username=>email, > password=>password in the beforefilter but couldn't figure how to > change the table name to reflect the new extended RegUser model > --- gets the password field from the RegUser form and hashes it so > that it can be compared with the confirm password field (which also > gets hashed) > > I know it's probably a bit of a mess and not the way to do things. But > I've learnt so much so far but now feel like I'm banging my head > against a brick wall. If anyone is able to shed a bit of light I'd > really appreciate it > > On Apr 6, 7:03 am, Zaky Katalan-Ezra <[email protected]> wrote: > > 1. I don't understand what do you mean by this: > > "but because I happen to have my register and login forms on the same > page". > > > > 2. just a guess. after saving the user get the last id and call login > with > > User and not RegUser > > if ($this->RegUser->save($this->data)) { > > $regNewId = $this->RegUser->getLastInsertID(); > > $logdetails = $this->User->read(null,$regNewId); > > $this->Auth->login($logdetails); > > ....... > > ....... > > > > 3. what this code for > > if (!empty($this->data['RegUser']['password'])) { > > $logdetails = $this->RegUser->read(); > > $this->data['RegUser']['password'] = > > $this->Auth->password($this->data['RegUser']['password']); > > } > > -- > 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 > [email protected] For more options, visit this group > at http://groups.google.com/group/cake-php > -- 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
