I'm new to CakePhp. So far it's been a great framework, but now I've
run into a bit of a snag.
The web app that we're working on has a client front end which is
completely separate from cakePhp (Currently using the Qooxdoo
library). The client and server comunicate using json and named
parameters, and for the most part it works great. The only thing that
I can't get working from the client is the login. I've tried to adapt
what's shown in the tutorials, but I think that I don't understand
Cake well enough yet.
I'm trying to take the username and password from the URL, and send it
to the Auth component. It fills what I send in to the fields, but it
doesn't actually log me in.
Thank you for your help
Alex
Here is what I have so far:
Url:
localhost/server/users/login/username:name/password:pass
Controller:
<?php
class UsersController extends AppController
{
var $name = 'User';
function beforeFilter()
{
$this->Auth->allow('*');
if(isSet($this->passedArgs['username']))
{
$this->data['User']['username'] = $this->passedArgs['username'];
}
if(isSet($this->passedArgs['password']))
{
$this->data['User']['password'] = $this->passedArgs['password'];
}
}
function login(){
}
function logout()
{
$this->redirect($this->Auth->logout());
}
}
View:
<h1>Log in</h1>
<?=$form->create('User',array('action'=>'login'));?>
<?=$form->input('username');?>
<?=$form->input('password', array('type'=>'password'));?>
<?=$form->end('login');?>
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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