wemersonrv

Autentica Controller

Nov 28th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. class Autentica_Controller extends Base_Controller{
  4.     public $restful = true;
  5.  
  6.     public function get_index(){
  7.         $view = View::make('dashboard.login');
  8.         if(Session::get('login_errors')){
  9.             $view = $view->with('login_errors', true);
  10.         }
  11.  
  12.         return $view;
  13.     }
  14.  
  15.     public function post_login(){
  16.         $userinfo = array(
  17.             'username' => Input::get('login'),
  18.             'password' => Input::get('senha')
  19.         );
  20.  
  21.         if(Auth::attempt($userinfo)){
  22.             return Redirect::to("/");
  23.         }else{
  24.             return Redirect::to_action('autentica')->with('login_errors', true);
  25.         }
  26.     }
  27.  
  28.     public function get_logout(){
  29.         Auth::logout();
  30.         return Redirect::to('/');
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment