Tuesday, December 28, 2010

Re: Help with function Login()--using Auth (Redirecting issue)

Hi,

I think the problem is due to other thing(s). I can't advise much without looking at all of the code. However, please refer http://book.cakephp.org/view/1250/Authentication to check if you have set-up authentication parameters correctly or not.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 11:49 AM, John Maxim <googol6@gmail.com> wrote:
Hi Amit,

I used your code:

 $this->redirect(array('controller' => 'posts', 'action' => 'index'));

but it still redirects me to the root directory...

What can be wrong ?



On Dec 29, 1:39 pm, Amit Badkas <amit.sanis...@gmail.com> wrote:
> Hi,
>
> In CakePHP, the views don't display directly, you need to render them using
> actions of controllers. From your description, it seems that you need to
> redirect to /posts/index page, so use
>
> $this->redirect(array('controller' => 'posts', 'action' => 'index'));
>
> to go to that page.
>
> Hope this helps.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
> On Wed, Dec 29, 2010 at 10:28 AM, John Maxim <goog...@gmail.com> wrote:
> > Users_controllers.php:
> > ~~~~
>
> > var $name = 'Users';
>
> > /*some codes in between*/
>
> > function login()
> > {
> >         if(!empty($this->data))
> >        {
> >                 // If the username/password match
> >                 if($this->Auth->login($this->data))
> >                 {
> >                 $this->redirect(array('action' => 'index'), null,
> > true);
> >                 } else {
> >                $this->User->invalidate('username', 'Username and password
> > combination is incorrect!');
> >                 }
> >         }
> >  }
>
> > -----------------
> > Hi,
>
> > After successful login, I want it to redirect to app/views/posts/
> > index.ctp
>
> > Originally, the redirect code is like this:
> > (1)
> > ~~
> > $this->redirect('/');
> > ~~
> > I changed to:
> > (2)
> > ~~
> >  $this->redirect(array('action' => 'index'), null, true);
> > ~~
> > (3)
> > ~~
> > $this->redirect(array('action' => 'views/posts/index'), null, true);
> > ~~
>
> > All failed to redirect to *app/views/posts/index.ctp
> > ~~
> > It consistently redirected me to my App/index.ctp which displays all
> > my cakephp versions stuff (mod rewrite...etc the green page),
> > regardless of the 3 redirect methods used above.
>
> > Is it something wrong with my Login() function instead ??
>
> > Thanks,
>
> > Maxim J.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: