Example #1
0
 public function index()
 {
     if (Auth::viaRemember() || Auth::user()) {
         return Redirect::to('users/dashboard');
     }
     return View::make('home.index');
 }
 public function doLogin()
 {
     // validate the info, create rules for the inputs
     $rules = array('email_login' => 'required|email', 'password_login' => 'required|min:3');
     // run the validation rules on the inputs from the form
     $validator = Validator::make(Input::all(), $rules);
     // if the validator fails, redirect back to the form
     if ($validator->fails()) {
         return Redirect::to('/')->withErrors($validator)->withInput(Input::except('password_login'))->withInput(Input::except('email_login'));
     } else {
         //return Redirect::to('index');
         // create our user data for the authentication
         $user = array('email' => Input::get('email_login'), 'password' => Input::get('password_login'));
         // var_dump(Auth::attempt($user));
         // attempt to do the login
         if (Auth::attempt($user) || Auth::viaRemember()) {
             $id = Auth::user()->id;
             Session::put('client_id', Auth::user()->id);
             Session::put('cart.items', '');
             return Redirect::intended('index');
         } else {
             // validation not successful, send back to form
             return Redirect::to('/');
         }
     }
 }
 public function getAuthState()
 {
     $state = new JobAuthState();
     $state->authMechanism = self::AUTH_MECHANISM;
     if (\Auth::check()) {
         $user = \Auth::user();
         $state->userId = $user->id;
         $state->rememberMe = \Auth::viaRemember();
         $state->actingUserId = \Acting::asWho()->id;
     }
     return $state;
 }
 public function login()
 {
     $rules = array('user_name' => 'required', 'password' => 'required');
     $message = array('user_name.required' => 'username must be entered', 'password.required' => 'password must be entered');
     $validator = Validator::make(Input::all(), $rules, $message);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator);
     } else {
         $user_data = array('user_name' => Input::get('user_name'), 'password' => Input::get('password'));
         $remember = Input::has('remember') ? true : false;
         if (Auth::attempt($user_data, $remember)) {
             if (Auth::viaRemember($remember)) {
                 return $value = Cookie::get('user_name');
             }
             // echo 'SUCCESS!';
             Session::flash('message', 'Successfully Login!');
             return Redirect::to('backend');
         } else {
             Session::flash('message', 'Your username/password combination was incorrect');
             return Redirect::to('login');
         }
     }
 }
Example #5
0
 /**
  * Check if the user is logged for show their respective home or login screen
  * 
  * @return View
  */
 public function showWelcomeView()
 {
     // Check if the user is reminded in the system
     if (Auth::check()) {
         return Auth::viaRemember() ? Redirect::to(Lang::get('routes.' . Auth::user()->rank))->with('rememberMe', 1) : Redirect::to(Lang::get('routes.' . Auth::user()->rank));
     } else {
         return View::make('login.welcome');
     }
 }
Example #6
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
// Filters
Route::filter('auth', function () {
    if (Auth::viaRemember()) {
        return Redirect::to('/login');
    }
});
// Route::get('/', 'UserController@feed');
Route::get('/', array('before' => 'auth', 'uses' => 'UserController@feed'));
Route::get('/settings', array('before' => 'auth', 'uses' => 'UserController@showSettings'));
Route::get('/about', 'ViewsController@about');
Route::get('/login', 'ViewsController@login');
Route::post('/login', 'UserController@authenticate');
Route::get('/signup', 'UserController@create');
Route::post('/signup', 'UserController@store');
Route::post('/getposter', 'MediaController@getPoster');
Route::get('/media/{imdbId}', 'MediaController@show');
Route::post('/search', 'MediaController@search');
Route::any('/usersearch', 'UserController@search');
Route::any('/postview', 'PostController@store');