Re: Simplest usage of the new Auth component?

2007-11-10 Thread Arne-Kolja Bachstein

Hi Sean,

I got it working now. The only thing that avoided the whole site from
working is the buggy allow() function. You must not put login and
logout into allow() to get auth working.

But thanks anyway, any help is getting one further in learning things,
right? :-)

Arne

On 10 Nov., 17:32, SeanW <[EMAIL PROTECTED]> wrote:
> Arne,
>
> You don't have to use the Acl component, I was just playing around
> with various things and forgot to take it out :)  (I'm just picking up
> CakePHP myself)
>
> If you don't have $this->Auth available, make sure you're using Auth
> in app_controller.php
>
> Sean
>
> On Nov 9, 8:12 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> > Hi Sean,
>
> > thanks for pasting it, but there's only one single issue that doesn't
> > match your config at all: You're using the Acl component... do I
> > _have_ to use Acl too? I though I could use it without Acl only using
> > the table data and such, so I did not work with Acl at all.
>
> > I did a bit debugging though and found that my users_controller->login
> > function doesnt have $this->Auth->user() available.
>
> > if ($this->Auth->user()) { ... } else { debug("no auth->user :-(") }
>
> > gives me the debug message, so for some reason I don't have access to
> > this what seems to be the point. Did I forget something?
>
> > Best regards
>
> > Arne
>
> > On Nov 9, 4:25 pm, SeanW <[EMAIL PROTECTED]> wrote:
>
> > > On Nov 8, 6:33 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> > > > But when submitting the form, it redirects me back to the login, pre-
> > > > filling the password field with 32 chars (assume it's the md5 hash,
> > > > but why?).
>
> > > That's probably because the authentication is failing, or not being
> > > checked.
>
> > > Remember I don't use username and password, I use email and password.
> > > So make sure that in app_controller.php where I have
>
> > > $this->Auth->fields = array('username' => 'email', 'password' =>
> > > 'password');
>
> > > you have
>
> > > $this->Auth->fields = array('username' => 'username', 'password' =>
> > > 'password');
>
> > > Did you also null out your salt in config.php?
>
> > > I posted my code (login.ctp and users_controller.php) 
> > > tohttp://pastebin.ca/767192
>
> > > Sean


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-10 Thread SeanW

Arne,

You don't have to use the Acl component, I was just playing around
with various things and forgot to take it out :)  (I'm just picking up
CakePHP myself)

If you don't have $this->Auth available, make sure you're using Auth
in app_controller.php

Sean

On Nov 9, 8:12 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
> Hi Sean,
>
> thanks for pasting it, but there's only one single issue that doesn't
> match your config at all: You're using the Acl component... do I
> _have_ to use Acl too? I though I could use it without Acl only using
> the table data and such, so I did not work with Acl at all.
>
> I did a bit debugging though and found that my users_controller->login
> function doesnt have $this->Auth->user() available.
>
> if ($this->Auth->user()) { ... } else { debug("no auth->user :-(") }
>
> gives me the debug message, so for some reason I don't have access to
> this what seems to be the point. Did I forget something?
>
> Best regards
>
> Arne
>
> On Nov 9, 4:25 pm, SeanW <[EMAIL PROTECTED]> wrote:
>
> > On Nov 8, 6:33 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> > > But when submitting the form, it redirects me back to the login, pre-
> > > filling the password field with 32 chars (assume it's the md5 hash,
> > > but why?).
>
> > That's probably because the authentication is failing, or not being
> > checked.
>
> > Remember I don't use username and password, I use email and password.
> > So make sure that in app_controller.php where I have
>
> > $this->Auth->fields = array('username' => 'email', 'password' =>
> > 'password');
>
> > you have
>
> > $this->Auth->fields = array('username' => 'username', 'password' =>
> > 'password');
>
> > Did you also null out your salt in config.php?
>
> > I posted my code (login.ctp and users_controller.php) 
> > tohttp://pastebin.ca/767192
>
> > Sean


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-09 Thread Arne-Kolja Bachstein

Hi again,

and sorry, I didnt answer your questions at all.

Yes, I made sure I had configured the right fields and salt is nulled
('') too.

Best regards

Arne

On Nov 9, 4:25 pm, SeanW <[EMAIL PROTECTED]> wrote:
> On Nov 8, 6:33 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> > But when submitting the form, it redirects me back to the login, pre-
> > filling the password field with 32 chars (assume it's the md5 hash,
> > but why?).
>
> That's probably because the authentication is failing, or not being
> checked.
>
> Remember I don't use username and password, I use email and password.
> So make sure that in app_controller.php where I have
>
> $this->Auth->fields = array('username' => 'email', 'password' =>
> 'password');
>
> you have
>
> $this->Auth->fields = array('username' => 'username', 'password' =>
> 'password');
>
> Did you also null out your salt in config.php?
>
> I posted my code (login.ctp and users_controller.php) 
> tohttp://pastebin.ca/767192
>
> Sean


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-09 Thread Arne-Kolja Bachstein

Hi Sean,

thanks for pasting it, but there's only one single issue that doesn't
match your config at all: You're using the Acl component... do I
_have_ to use Acl too? I though I could use it without Acl only using
the table data and such, so I did not work with Acl at all.

I did a bit debugging though and found that my users_controller->login
function doesnt have $this->Auth->user() available.

if ($this->Auth->user()) { ... } else { debug("no auth->user :-(") }

gives me the debug message, so for some reason I don't have access to
this what seems to be the point. Did I forget something?

Best regards

Arne



On Nov 9, 4:25 pm, SeanW <[EMAIL PROTECTED]> wrote:
> On Nov 8, 6:33 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> > But when submitting the form, it redirects me back to the login, pre-
> > filling the password field with 32 chars (assume it's the md5 hash,
> > but why?).
>
> That's probably because the authentication is failing, or not being
> checked.
>
> Remember I don't use username and password, I use email and password.
> So make sure that in app_controller.php where I have
>
> $this->Auth->fields = array('username' => 'email', 'password' =>
> 'password');
>
> you have
>
> $this->Auth->fields = array('username' => 'username', 'password' =>
> 'password');
>
> Did you also null out your salt in config.php?
>
> I posted my code (login.ctp and users_controller.php) 
> tohttp://pastebin.ca/767192
>
> Sean


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-09 Thread SeanW

On Nov 8, 6:33 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
> But when submitting the form, it redirects me back to the login, pre-
> filling the password field with 32 chars (assume it's the md5 hash,
> but why?).

That's probably because the authentication is failing, or not being
checked.

Remember I don't use username and password, I use email and password.
So make sure that in app_controller.php where I have

$this->Auth->fields = array('username' => 'email', 'password' =>
'password');

you have

$this->Auth->fields = array('username' => 'username', 'password' =>
'password');

Did you also null out your salt in config.php?

I posted my code (login.ctp and users_controller.php) to 
http://pastebin.ca/767192

Sean


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-08 Thread Arne-Kolja Bachstein

Hi Sean,

it doesn't work the way you posted it, except for me. But I assume it
could also be something with my login view, so could you please post
an example of a working view for this?

Atm I'm doing the following:

// /app/views/users/login.ctp



create('User', array('action' => 'login'));
  echo $form->input('username');
  echo $form->input('password');
  echo $form->submit(__('do_login', true));
  echo $form->end();
?>

// end

But when submitting the form, it redirects me back to the login, pre-
filling the password field with 32 chars (assume it's the md5 hash,
but why?).

Thanks in advance,

Arne

On Nov 8, 9:04 pm, SeanW <[EMAIL PROTECTED]> wrote:
> On Nov 7, 9:07 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
>
>
> > My goal is to implement the authentication basics directly into /app/
> > app_controller.php rather than the users controller, as I think it
>
> I posted something about this recently, where authentication is done
> in the main app_controller with default behaviours, and controllers
> can fine tune it.
>
> http://ertw.com/blog/2007/11/04/a-simple-authentication-system-with-c...
>
> It uses controller based authorization (which again can have a global
> policy at the app_controller level, and be overridden at the
> controller level)
>
> Sean


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-08 Thread SeanW

On Nov 7, 9:07 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> My goal is to implement the authentication basics directly into /app/
> app_controller.php rather than the users controller, as I think it

I posted something about this recently, where authentication is done
in the main app_controller with default behaviours, and controllers
can fine tune it.

http://ertw.com/blog/2007/11/04/a-simple-authentication-system-with-cakephp-12-and-auth-component/

It uses controller based authorization (which again can have a global
policy at the app_controller level, and be overridden at the
controller level)

Sean


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-08 Thread theman

I've been having similar problems myself but just haven't taken the
time to look into what's going on.

In my scenario I'm able to login and the Auth component authenticates
me but does not redirect me to the redirectLogin value.  After
submitting my information I end up on the login page still, and if I
manually type in an application URL I am able to access the
application no problem.

Like I said I haven't looked into this because I know this is Alpha..
Beta.. whatever and it's not stopping me from moving forward with
other development, but I have a feeling there might be a problem in
the redirect logic??

Also another scenario I will have autoRedirect = true and on the first
submission of the login page I will just end up at the login page
again.  If I re-enter my credentials and submit a second time I will
be forwarded to the URL I was requesting previously.


On Nov 8, 1:04 am, francky06l <[EMAIL PROTECTED]> wrote:
> The Auth is using the sha1 (by default) for hashing. It combines you
> Security.salt value and your password and hash using sha1. You can
> change the hashing I think (not sure, I haven't check in the code for
> a while).
>
> On Nov 8, 5:30 am, "Paolo Stancato" <[EMAIL PROTECTED]> wrote:
>
> > I am having troubles with Auth component too (but after the login
> > step). My code is very similar, except that I'm using in
> > AppController:
>
> > function isAuthorized() {
> >// This should authorize any controller/action, even if I'm not
> > logged in, right?
> >return true;
>
> > }
>
> > But when I try to access to any controller/action I'm being redirected
> > to users/login.
>
> > Thanks in advance!
>
> > 2007/11/8, Arne-Kolja Bachstein <[EMAIL PROTECTED]>:
>
> > > Hi there,
>
> > > I tried to implement a simple authentication using the new Auth
> > > component from CakePHP 1.2, but did not succeed. Maybe there's someone
> > > who can give me quick and dirty assistance with this?
>
> > > My goal is to implement the authentication basics directly into /app/
> > > app_controller.php rather than the users controller, as I think it
> > > could be easier then to make it "global", but any other ideas are also
> > > welcome, of course.
>
> > > Basically I tried this snippet that derelm pasted for me to build my
> > > authentication system:
> > >http://bin.cakephp.org/view/1369491463
> > > ... but as I already mentioned I failed.
>
> > > The main problem is, of course, that I cannot log in. When trying to
> > > login it sends me directly back to the login page as given in $this-
> > > >Auth->loginAction, but as I don't know how to output the error
> > > message, I can't tell what's the problem. Maybe it's the combination
> > > of my old md5'd varchar[50] field for the password, as I don't know
> > > how the password is hashed by  the component, but I don't really know.
> > > Doing a print_r on $this->Auth doesn't give me any hints too, except
> > > for the login data being posted, but nothing about the verification of
> > > it.
>
> > > Second problem would be, just to anticipate, that I'd had to check the
> > > user's login details in my default layout. So if you know how to talk
> > > to the auth component from there, let me know :-)
>
> > > Well, maybe I just need too basic details on this, but I'd really
> > > appreciate if there's someone who can help me with this :-)
>
> > > Thanks in advance,
>
> > > Arne


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-08 Thread francky06l

The Auth is using the sha1 (by default) for hashing. It combines you
Security.salt value and your password and hash using sha1. You can
change the hashing I think (not sure, I haven't check in the code for
a while).

On Nov 8, 5:30 am, "Paolo Stancato" <[EMAIL PROTECTED]> wrote:
> I am having troubles with Auth component too (but after the login
> step). My code is very similar, except that I'm using in
> AppController:
>
> function isAuthorized() {
>// This should authorize any controller/action, even if I'm not
> logged in, right?
>return true;
>
> }
>
> But when I try to access to any controller/action I'm being redirected
> to users/login.
>
> Thanks in advance!
>
> 2007/11/8, Arne-Kolja Bachstein <[EMAIL PROTECTED]>:
>
>
>
> > Hi there,
>
> > I tried to implement a simple authentication using the new Auth
> > component from CakePHP 1.2, but did not succeed. Maybe there's someone
> > who can give me quick and dirty assistance with this?
>
> > My goal is to implement the authentication basics directly into /app/
> > app_controller.php rather than the users controller, as I think it
> > could be easier then to make it "global", but any other ideas are also
> > welcome, of course.
>
> > Basically I tried this snippet that derelm pasted for me to build my
> > authentication system:
> >http://bin.cakephp.org/view/1369491463
> > ... but as I already mentioned I failed.
>
> > The main problem is, of course, that I cannot log in. When trying to
> > login it sends me directly back to the login page as given in $this-
> > >Auth->loginAction, but as I don't know how to output the error
> > message, I can't tell what's the problem. Maybe it's the combination
> > of my old md5'd varchar[50] field for the password, as I don't know
> > how the password is hashed by  the component, but I don't really know.
> > Doing a print_r on $this->Auth doesn't give me any hints too, except
> > for the login data being posted, but nothing about the verification of
> > it.
>
> > Second problem would be, just to anticipate, that I'd had to check the
> > user's login details in my default layout. So if you know how to talk
> > to the auth component from there, let me know :-)
>
> > Well, maybe I just need too basic details on this, but I'd really
> > appreciate if there's someone who can help me with this :-)
>
> > Thanks in advance,
>
> > Arne


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Simplest usage of the new Auth component?

2007-11-07 Thread Paolo Stancato

I am having troubles with Auth component too (but after the login
step). My code is very similar, except that I'm using in
AppController:

function isAuthorized() {
   // This should authorize any controller/action, even if I'm not
logged in, right?
   return true;
}

But when I try to access to any controller/action I'm being redirected
to users/login.


Thanks in advance!


2007/11/8, Arne-Kolja Bachstein <[EMAIL PROTECTED]>:
>
> Hi there,
>
> I tried to implement a simple authentication using the new Auth
> component from CakePHP 1.2, but did not succeed. Maybe there's someone
> who can give me quick and dirty assistance with this?
>
> My goal is to implement the authentication basics directly into /app/
> app_controller.php rather than the users controller, as I think it
> could be easier then to make it "global", but any other ideas are also
> welcome, of course.
>
> Basically I tried this snippet that derelm pasted for me to build my
> authentication system:
> http://bin.cakephp.org/view/1369491463
> ... but as I already mentioned I failed.
>
> The main problem is, of course, that I cannot log in. When trying to
> login it sends me directly back to the login page as given in $this-
> >Auth->loginAction, but as I don't know how to output the error
> message, I can't tell what's the problem. Maybe it's the combination
> of my old md5'd varchar[50] field for the password, as I don't know
> how the password is hashed by  the component, but I don't really know.
> Doing a print_r on $this->Auth doesn't give me any hints too, except
> for the login data being posted, but nothing about the verification of
> it.
>
> Second problem would be, just to anticipate, that I'd had to check the
> user's login details in my default layout. So if you know how to talk
> to the auth component from there, let me know :-)
>
> Well, maybe I just need too basic details on this, but I'd really
> appreciate if there's someone who can help me with this :-)
>
> Thanks in advance,
>
> Arne
>
>
> >
>

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---