hey guys,
I'm working on a almost complete AJAX website including a AJAX Login.
After a little work I got it to work but don't think this is the
"best" or "cake" way to do it.
My Idea was to display a little element (in the Div "LoginBox" (see
ajax->form)) which gives me a Logout button and further information
about the logged in user. I don't want to redirect.
What do you think?
Here is my Code:
ajax-form:
echo $ajax->form(array('type' => 'post',
'options' => array(
'model'=>'User',
'update'=>'loginbox',
'url' => array(
'controller' => 'users',
'action' => 'login'
)
)
));
--------------
controller:
function beforeFilter() {
$this->Auth->autoRedirect = false;
}
-----
function login() {
if ($this->Auth->user() != NULL) {
$this->redirect('/users/logedin');
}
}
----
function logedin() {
$this->layout = "ajaxoutput";
$this->render('/elements/logedin');
}
In the element ist only text.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---