public function linkedInLogin() { try { OAuth::login('linkedin', function ($user, $details) { $user->linkedin_id = $details->userId; $user->name = $details->firstName . ' ' . $details->lastName; $user->email = $details->email; $user->profile_image = $details->imageUrl; $user->save(); }); } catch (ApplicationRejectedException $e) { // User rejected application } catch (InvalidAuthorizationCodeException $e) { // Authorization was attempted with invalid // code,likely forgery attempt } // Current user is now available via Auth facade $user = Auth::user(); Session::flash('message', 'You have successfully registered'); return Redirect::to('/comingsoon'); }
$groupType = getConfig($config, 'group_type', TRUE); $dbName = getConfig($config, 'db_name', TRUE); $groupShare = getConfig($config, 'group_share', FALSE, FALSE); require_once "lib/Auth/Auth.class.php"; require_once "lib/{$authType}/{$authType}.class.php"; if ($groupShare) { require_once "lib/Groups/Groups.class.php"; require_once "lib/{$groupType}/{$groupType}.class.php"; } require_once "ext/sag/src/Sag.php"; require_once "lib/Files/Files.class.php"; if (getConfig($config, 'allow_oauth', FALSE, FALSE) && getRequest('oauth_signature', FALSE, FALSE)) { // try OAuth authentication require_once "lib/OAuth/OAuth.class.php"; $auth = new OAuth($config); $auth->login(); } if (!isset($auth) || empty($auth)) { $auth = new $authType($config); } if (!$auth->isLoggedIn()) { $auth->login(); } if ($groupShare) { $groups = new $groupType($config, $auth); } else { $groups = NULL; } $action = getRequest('action', FALSE, 'showFiles'); $useRest = getRequest('useRest', FALSE, FALSE); $storage = new Sag();
use App\Models\patterns\Category; use App\Models\patterns\Subcategory; Route::get('/', ['as' => 'patterns.latest', 'uses' => 'home\\PatternController@latest']); Route::get('/populares', ['as' => 'patterns.popular', 'uses' => 'home\\PatternController@popular']); Route::get('/pendientes', ['as' => 'patterns.open', 'uses' => 'home\\PatternController@open']); Route::get('/pending', ['as' => 'patterns.pending', 'uses' => 'home\\PatternController@pending']); Route::get('/tutoriales', ['as' => 'patterns.closed', 'uses' => 'home\\PatternController@closed']); Route::get('/solicitud/{id}', ['as' => 'patterns.details', 'uses' => 'home\\PatternController@details']); // Authentication Social routes ... Route::get('{provider}/authorize', function ($provider) { return OAuth::authorize($provider); }); Route::get('{provider}/login', function ($provider) { OAuth::login($provider, function ($user, $userDetails) { $user->username = $userDetails->nickname; $user->email = $userDetails->email; $user->save(); }); return view('admin/dashboard'); }); // Authentication routes ... Route::get('login', ['uses' => 'Auth\\AuthController@getLogin', 'as' => 'login']); Route::post('login', 'Auth\\AuthController@postLogin'); Route::get('logout', ['uses' => 'Auth\\AuthController@getLogout', 'as' => 'logout']); // Registration routes ... Route::get('register', ['uses' => 'Auth\\AuthController@getRegister', 'as' => 'register']); Route::post('register', 'Auth\\AuthController@postRegister'); Route::get('confirmation/{token}', ['uses' => 'Auth\\AuthController@getConfirmation', 'as' => 'confirmation']); // Password reset ink request routes ... Route::get('password/email', 'Auth\\PasswordController@getEmail'); Route::post('password/email', 'Auth\\PasswordController@postEmail');
} else { return view('home.home'); } }); Route::get('auth', function () { return OAuth::authorize('facebook'); }); Route::get('logout', array('as' => 'logout', function () { }))->before('auth'); Route::get('login', function () { try { OAuth::login('facebook', function ($user, $details) { $exist = User::where('email', $details->email)->first(); if ($exist) { $user = $exist; } $user->name = $details->full_name; $user->email = $details->email; $user->provider_user_id = $details->id; return $user; }); $user = Auth::user(); if ($user->password == "") { return view('home.registro'); } else { return Redirect::guest('inicio'); } } catch (ApplicationRejectedException $e) { // Usuario Rechazó aplicación } catch (InvalidAuthorizationCodeException $e) { // Autorización se intentó con código no válido, probable intento de falsificación } catch (PDOException $e) {
$data['username'] = $_POST['username']; } if (isset($_POST['email'])) { $data['email'] = $_POST['email']; } foreach (UserFields::all('signup') as $key => $field) { if (isset($_POST[$key])) { $data['usermeta'][$key] = escape($_POST[$key]); } } } if (OAuth::signup($provider, $data)) { OAuth::login($provider, $user['id']); } } else { OAuth::login($provider, $user['id']); } if (OAuth::passes()) { $url = Config::get('auth.login_redirect'); $url = empty($url) ? App::url() : $url; redirect_to($url); } ?> <?php echo View::make('header')->render(); ?> <div class="row"> <div class="col-md-6"> <h3 class="page-header">
<div class="form-group"> <div class="col-sm-offset-2 col-sm-6"> <div class="checkbox"> <label> <input type="checkbox" name="remember" value="1"> Remember me </label> </div> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-6"> <button type="submit" class="btn btn-primary">Login</button> <a href="<?php echo OAuth::login('facebook')->redirect('admin'); ?> " class="btn btn-primary">Login with Facebook</a> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-6"> <a href="<?php echo URL::to('password'); ?> ">Reset Password</a> </div> </div> </fieldset> <?php