Bingo! check("Auth.User") works, check("User") doesn't (maybe that
article was written for 1.1?)
Thanks for the help!
Alex
On Sep 27, 3:31 am, aaron50x <aaron...@gmail.com> wrote:
> Well alex_c, try the $this->Session->chek('Auth.User')... and you only
> can see the uploadpictures after logging, because only the show and
> the register actions are allowed without login, so for any other
> action you will need to login first.
>
> And I'm not pretty sure, but I think that you should define the login
> action like this:
> if (!empty($this->data)) {
> if (!$this->Auth->login()) {
> $this->Session->setFlash(__("incorrectLogin", true));
> }
> }
>
> Well, that's the way I use it.
>
> I hope this to be useful for you.
>
> On 27 sep, 01:02, alex_c <alex.cure...@gmail.com> wrote:
>
> > Hi all,
>
> > I've been pouring over the docs and this group, but I can't really
> > figure it out.
>
> > In my UsersController, I've included
>
> > var $components = array('Auth');
> > function beforeFilter()
> > {
> > $this->Auth->allow('register', 'show');
> > $this->Auth->loginRedirect = array('controller' => 'users',
> > 'action' => 'uploadpictures');
>
> > // parent::beforeFilter();
> > }
> > function login() {
>
> > }
>
> > function logout() {
> > $this->redirect($this->Auth->logout());
> > }
>
> > I have the login.ctp with the proper form fields.
>
> > Login and logout seem to work - I can only access /users/
> > uploadpictures after logging in, and can't access it after logging
> > out. So far so good.
>
> > Now, I'm trying to determine if the user is logged in. According to
> > this - http://snook.ca/archives/cakephp/setting_layout/ - I should
> > be able to just use $this->Session->check('User') in the controller,
> > but it always returns false.
>
> > Doing a debug($this->Session) in the controller, or debug ($session)
> > in the view, shows no traces of the user information anywhere in the
> > session.
>
> > I am clearly missing something - either in my understanding of Auth,
> > or in my understanding of sessions (or both). From what I've read it
> > seems to me that Auth is supposed to automagically store the user data
> > in the session after a successful login - maybe that's incorrect?
>
> > Again, thanks so much for any help!
>
> > Alex
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment