Thursday, May 5, 2011

Re: how can I set my home page

Yes I'm using the Auth component, and yes I've added the Auth
component in my AppController.
I'm new to CakePhp so this might sound like a stupid question

I added the home action on $this->Auth-
>allow('index','view','recover','verify','home');
I thought this would solve the problem but its still asking me to log
in. Please advice.

this is my Appcontroller:

class AppController extends Controller {
var $components = array('Auth','Session','Email');
//var $helpers = array('Time');


function beforeFilter(){
$this->Auth->allow('index','view','recover','verify','home');
$this->Auth->userModel = 'Practitioner';
$this->Auth->fields = array('username' => 'email', 'password' =>
'password');
$this->Auth->authError = 'To login please enter your email and
password!';
$this->Auth->loginError = 'Incorect Email or password combination.';
$this->Session->write('Auth.redirect', null);
$this->Auth->loginRedirect = array('controller' => 'Practitioners',
'action' => 'index');
$this->Auth->logoutRedirect = array(Configure::read('Routing.admin')
=> false, 'controller' => 'Practitioners', 'action' => 'logout');
$this->Model->authUserId = $this->Auth->user('id');
}
}

Thanks in advance

On May 4, 10:56 am, Ryan Schmidt <google-2...@ryandesign.com> wrote:
> On May 3, 2011, at 17:07, mthabisi mlunjwa wrote:
>
> > I'm trying to set home.ctp as my home page/landing page. But no matter
> > how I try I'm redirected to a different page(http://domain.com/
> > practitioners/login).
>
> Sounds like you've added the Auth component (possibly to your AppController). Is that possible? If so, that's what's asking you to log in here.
>
> http://book.cakephp.org/view/1250/Authentication
>
> If you don't want users to have to log in to see your home page, then you need to tell the Auth component that, for example by allowing the display action. (This will allow all URLs handled by the Pages controller (not just the home page) to be displayed.)
>
> http://book.cakephp.org/view/1656/allowedActions

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: