Advertisement
Guest User

Untitled

a guest
Sep 28th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2.  
  3. return array(
  4.  
  5.     'GET /auth/signin' => array( 'name' => 'signin', 'before' => 'noauth', 'do' => function() {
  6.    
  7.         return View::make( 'layouts/default' )->partial( 'content', 'auth/signin' );
  8.    
  9.     } ),
  10.    
  11.     'POST /auth/signin' => array( 'before' => 'noauth, csrf', 'do' => function() {
  12.        
  13.         $username = Input::get( 'username' );
  14.         $password = Input::get( 'password' );
  15.        
  16.         if( empty( $username  ) || empty( $password ) ) {
  17.        
  18.             return Redirect::to_signin()->with( 'error', 'You must enter a username and password.' );
  19.        
  20.         }
  21.         elseif( !Auth::login( $username, $password ) ) {
  22.        
  23.             return Redirect::to_signin()->with( 'error', 'Invalid username/password.' );
  24.        
  25.         }
  26.         else {
  27.        
  28.             return Redirect::to_home();
  29.        
  30.         }
  31.    
  32.     } )
  33.  
  34. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement