Skip to content

Instantly share code, notes, and snippets.

@nilamdoc
Created December 11, 2012 06:46
Show Gist options
  • Save nilamdoc/4256397 to your computer and use it in GitHub Desktop.
Save nilamdoc/4256397 to your computer and use it in GitHub Desktop.
Users Controller
<?php
namespace app\controllers;
use app\models\Users;
use lithium\security\Auth;
use lithium\storage\Session;
class UsersController extends \lithium\action\Controller {
public function index(){
$users = Users::all();
return compact('users');
}
public function signup() {
$user = Users::create();
if(($this->request->data) && $user->save($this->request->data)) {
$this->redirect('Users::index');
}
return compact(array('user'));
}
public function login() {
if ($this->request->data && Auth::check('member', $this->request)) {
return $this->redirect('Users::index');
}
}
public function logout() {
Auth::clear('member');
return $this->redirect('Users::index');
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment