Re: How do I create a login element
Sorry. That should have been /app/views/elements/login.thtmlOn 7/11/06, John Zimmerman [gmail] <[EMAIL PROTECTED] > wrote:I just created a form in /app/elements/login.thtml with a username box and a password box with a "login" button. I conditionally check to see if the user is logged in within my element to display the current name of the logged in user with a logout button. if($this->controller->Session->check('LoggedInUser')) { //display current username and logout button. logout button posts to /users/logout} else { //display login form. login form posts to /users/login} I can render the login element on any page using $this->renderElement('login'); in my view or page layout.Works well for me. I can capture the page they were on using a hidden element in the form and redirect back to that page after login, or I can get that page from the cake controller. The above is just a general description and rough code for what I did. I didn't copy and paste so you will most likely have to tweak it to make it worth anything.I do have this working quite well on a couple of sites I am developing so post back if you can't get it and I will put code into the CakeBin with some instructions. On 7/11/06, John David Anderson (_psychic_) < [EMAIL PROTECTED]> wrote: On Jul 11, 2006, at 6:44 PM, codecowboy wrote:>> Hi,>> I have followed the instuctions in chapter 21 of the manual to> create a> user authentication system. I have that system completely working. >> I want to create a login element that functions the same way. This> way, I can place the login element in the left column of my layout.>> The problem that I am running into is that cake requires the view > to be> related to an action. I do not know how to tell cake that the login> element is the view for the users/login action.I'd just leave it as an action and use $this->requestAction() to pull it into places you want it displayed.requestAction('/users/login', array('return')); ?>-- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: How do I create a login element
I just created a form in /app/elements/login.thtml with a username box and a password box with a "login" button.I conditionally check to see if the user is logged in within my element to display the current name of the logged in user with a logout button. if($this->controller->Session->check('LoggedInUser')) { //display current username and logout button. logout button posts to /users/logout} else { //display login form. login form posts to /users/login} I can render the login element on any page using $this->renderElement('login'); in my view or page layout.Works well for me. I can capture the page they were on using a hidden element in the form and redirect back to that page after login, or I can get that page from the cake controller. The above is just a general description and rough code for what I did. I didn't copy and paste so you will most likely have to tweak it to make it worth anything.I do have this working quite well on a couple of sites I am developing so post back if you can't get it and I will put code into the CakeBin with some instructions. On 7/11/06, John David Anderson (_psychic_) <[EMAIL PROTECTED]> wrote: On Jul 11, 2006, at 6:44 PM, codecowboy wrote:>> Hi,>> I have followed the instuctions in chapter 21 of the manual to> create a> user authentication system. I have that system completely working. >> I want to create a login element that functions the same way. This> way, I can place the login element in the left column of my layout.>> The problem that I am running into is that cake requires the view > to be> related to an action. I do not know how to tell cake that the login> element is the view for the users/login action.I'd just leave it as an action and use $this->requestAction() to pull it into places you want it displayed.requestAction('/users/login', array('return')); ?>-- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: How do I create a login element
On Jul 11, 2006, at 6:44 PM, codecowboy wrote: > > Hi, > > I have followed the instuctions in chapter 21 of the manual to > create a > user authentication system. I have that system completely working. > > I want to create a login element that functions the same way. This > way, I can place the login element in the left column of my layout. > > The problem that I am running into is that cake requires the view > to be > related to an action. I do not know how to tell cake that the login > element is the view for the users/login action. I'd just leave it as an action and use $this->requestAction() to pull it into places you want it displayed. requestAction('/users/login', array('return')); ?> -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
How do I create a login element
Hi, I have followed the instuctions in chapter 21 of the manual to create a user authentication system. I have that system completely working. I want to create a login element that functions the same way. This way, I can place the login element in the left column of my layout. The problem that I am running into is that cake requires the view to be related to an action. I do not know how to tell cake that the login element is the view for the users/login action. Does anyone know how to do this? Thank you, codecowboy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---