There's nothing really out of the ordinary going on here, it's basic Cake
stuff.
Your ajax form should POST the data to /users/login. Then your controller
action can look something like:
public function login() {
if ($this->Auth->login($this->data) {
// set flash
// set user data via $this->Auth->user()
} else {
// set flash
}
}
You should probably have a json view for this so the Ajax function can
interpret it.
On Sunday, February 26, 2012 12:55:04 PM UTC-8, @dariobarila wrote:
>
> I know this tutorial and coded for learning cake, but there is a lot
> of magic under $this->Auth->login, what I need is to understand of can
> I use username and password retrieved from $this->request to identify
> an user and return user ID to make some business logic...
>
> Thank you anyway for your response...
>
>
>
>
> On 26 Feb, 19:57, Tilen Majerle <[email protected]> wrote:
> > http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp...
>
> >
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
> >
> > 2012/2/26 @dariobarila <[email protected]>
> >
> >
> >
> >
> >
> >
> >
> > > Hi all,
> > > I'm developing a bookmarklet for social shopping, I need to let user
> > > to authenticate trough my bookmarklet via ajax, my idea is to send to
> > > my cakeapp username & password and with a cookie on the browser store
> > > a session after cake has authenticated the user.
> >
> > > I've tried to grab username & psw trough $this->request->query and
> > > then I set $this->request->data["User"];
> > > Next I call $this->Auth->login($this->data["User"]) hoping that cake
> > > will authenticate the user and return me the user model with ID and
> > > other fields...
> >
> > > But it's not working...
> >
> > > The cakebook is not helping me... :(
> >
> > > I'm a frontend developer, but a this time I need some backend and I
> > > love Cake.
> >
> > > Any idea to help me?
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > [email protected] For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
On Sunday, February 26, 2012 12:55:04 PM UTC-8, @dariobarila wrote:
>
> I know this tutorial and coded for learning cake, but there is a lot
> of magic under $this->Auth->login, what I need is to understand of can
> I use username and password retrieved from $this->request to identify
> an user and return user ID to make some business logic...
>
> Thank you anyway for your response...
>
>
>
>
> On 26 Feb, 19:57, Tilen Majerle <[email protected]> wrote:
> > http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp...
>
> >
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
> >
> > 2012/2/26 @dariobarila <[email protected]>
> >
> >
> >
> >
> >
> >
> >
> > > Hi all,
> > > I'm developing a bookmarklet for social shopping, I need to let user
> > > to authenticate trough my bookmarklet via ajax, my idea is to send to
> > > my cakeapp username & password and with a cookie on the browser store
> > > a session after cake has authenticated the user.
> >
> > > I've tried to grab username & psw trough $this->request->query and
> > > then I set $this->request->data["User"];
> > > Next I call $this->Auth->login($this->data["User"]) hoping that cake
> > > will authenticate the user and return me the user model with ID and
> > > other fields...
> >
> > > But it's not working...
> >
> > > The cakebook is not helping me... :(
> >
> > > I'm a frontend developer, but a this time I need some backend and I
> > > love Cake.
> >
> > > Any idea to help me?
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > [email protected] For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
On Sunday, February 26, 2012 12:55:04 PM UTC-8, @dariobarila wrote:
>
> I know this tutorial and coded for learning cake, but there is a lot
> of magic under $this->Auth->login, what I need is to understand of can
> I use username and password retrieved from $this->request to identify
> an user and return user ID to make some business logic...
>
> Thank you anyway for your response...
>
>
>
>
> On 26 Feb, 19:57, Tilen Majerle <[email protected]> wrote:
> > http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp...
>
> >
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
> >
> > 2012/2/26 @dariobarila <[email protected]>
> >
> >
> >
> >
> >
> >
> >
> > > Hi all,
> > > I'm developing a bookmarklet for social shopping, I need to let user
> > > to authenticate trough my bookmarklet via ajax, my idea is to send to
> > > my cakeapp username & password and with a cookie on the browser store
> > > a session after cake has authenticated the user.
> >
> > > I've tried to grab username & psw trough $this->request->query and
> > > then I set $this->request->data["User"];
> > > Next I call $this->Auth->login($this->data["User"]) hoping that cake
> > > will authenticate the user and return me the user model with ID and
> > > other fields...
> >
> > > But it's not working...
> >
> > > The cakebook is not helping me... :(
> >
> > > I'm a frontend developer, but a this time I need some backend and I
> > > love Cake.
> >
> > > Any idea to help me?
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > [email protected] For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php