My bookmarklet can't post data due to crossdomain restriction, I can
only send GET requests with jsonp, so I've writed some code like this:
$this->data->["User"]["username"] = $this->request->query["username"];
(some for password) and then passed $this->data to $this->Auth-
>login...
btw I will make some test and I will update you...
meantime I've used $this->User->findByUsernameandPassword to retrieve
the actual user (using the auth hashing for passwords) ;)
Thank you again
On 27 Feb, 16:51, jeremyharris <funeralm...@gmail.com> wrote:
> 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 <tilen.maje...@gmail.com> wrote:
> > >http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp...
>
> > > --
> > > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > > 2012/2/26 @dariobarila <dario.bar...@gmail.com>
>
> > > > 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.organdhelp
> > > > 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
> > > > 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 <tilen.maje...@gmail.com> wrote:
> > >http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp...
>
> > > --
> > > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > > 2012/2/26 @dariobarila <dario.bar...@gmail.com>
>
> > > > 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.organdhelp
> > > > 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
> > > > 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 <tilen.maje...@gmail.com> wrote:
> > >http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp...
>
> > > --
> > > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > > 2012/2/26 @dariobarila <dario.bar...@gmail.com>
>
> > > > 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.organdhelp
> > > > 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
> > > > 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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment