Created
December 11, 2012 06:46
-
-
Save nilamdoc/4256397 to your computer and use it in GitHub Desktop.
Users Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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