Skip to content

Instantly share code, notes, and snippets.

@josegonzalez
Created October 2, 2010 03:01
Show Gist options
  • Save josegonzalez/607211 to your computer and use it in GitHub Desktop.
Save josegonzalez/607211 to your computer and use it in GitHub Desktop.
Example usage of CakeForm
<?php
class UsersController extends AppController {
/**
* Automagic login via AuthComponent
*
* @return void
* @author Jose Diaz-Gonzalez
*/
function login() {
}
/**
* Alternative login for administrators
*
* @return void
* @author Jose Diaz-Gonzalez
*/
function authenticate() {
$login_form = new LoginForm();
if (!empty($this->data)) {
$login_form->bindData($this->data);
if ($login_form->isValid()) {
$login_form->execute();
}
}
$this->set(compact('login_form'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment