Re: Stupid question

2012-08-13 Thread scs
Your redirect is happening even if you are logged int. try this adjustment:
 public function login() {
   if($this->request->is('post')) {
  if($this->Auth->login()) {
//User is authorized so see if they have an owner 
//record   
   $results = 
$this->User->findById($this->Auth->user('id'));
   $this->set('results',$results);
  }else{
   $this->redirect($this->Auth->redirect());
  }
} else {
$this->Session->setFlash(_('Invalid name or password,try 
again'));
}
  }


On Sunday, August 12, 2012 7:40:45 PM UTC-4, Toren Valone wrote:
>
> I know this is probably a simple answer, but i appear to be stumped, I 
> have a user controller, which authorizes a user and then checks to see if 
> they user has an owner record. Unfortuanltly my code just flies over the 
> code and hits the redirect in the appcontroller. Here is the 
> UserController.php code.  
>
>  public function login() {
>   if($this->request->is('post')) {
>  if($this->Auth->login()) {
>  //User is authorized so see if they have an owner 
>  //record   
>  $results = $this->User->findById($this->Auth->user('id'));
>  $this->set('results',$results);
>
>  }
> $this->redirect($this->Auth->redirect());
>  } else {
> $this->Session->setFlash(_('Invalid name or password,try 
> again'));
>  }
>   }
>
> here is the view in Users/is_owner.ctp
>
> 
> 
>
>
>

-- 
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Stupid question

2012-08-12 Thread Sanjeev Divekar
You have coded   $this->redirect($this->Auth->redirect());  that's why it's 
redirecting

On Monday, 13 August 2012 05:10:45 UTC+5:30, Toren Valone wrote:
>
> I know this is probably a simple answer, but i appear to be stumped, I 
> have a user controller, which authorizes a user and then checks to see if 
> they user has an owner record. Unfortuanltly my code just flies over the 
> code and hits the redirect in the appcontroller. Here is the 
> UserController.php code.  
>
>  public function login() {
>   if($this->request->is('post')) {
>  if($this->Auth->login()) {
>  //User is authorized so see if they have an owner 
>  //record   
>  $results = $this->User->findById($this->Auth->user('id'));
>  $this->set('results',$results);
>
>  }
> $this->redirect($this->Auth->redirect());
>  } else {
> $this->Session->setFlash(_('Invalid name or password,try 
> again'));
>  }
>   }
>
> here is the view in Users/is_owner.ctp
>
> 
> 
>
>
>

-- 
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Stupid question

2012-08-12 Thread Toren Valone
I know this is probably a simple answer, but i appear to be stumped, I have
a user controller, which authorizes a user and then checks to see if they
user has an owner record. Unfortuanltly my code just flies over the code
and hits the redirect in the appcontroller. Here is the UserController.php
code.

 public function login() {
  if($this->request->is('post')) {
 if($this->Auth->login()) {
 //User is authorized so see if they have an owner
 //record
 $results = $this->User->findById($this->Auth->user('id'));
 $this->set('results',$results);

 }
$this->redirect($this->Auth->redirect());
 } else {
$this->Session->setFlash(_('Invalid name or password,try
again'));
 }
  }

here is the view in Users/is_owner.ctp




-- 
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.