}); Route::GET('github/login', function () { SocialAuth::login('github', function ($user, $userdetails) { var_dump($userdetails); $user->email = $userdetails->email; $user->id = $userdetails->id; $user->save(); }); return "DONE "; }); Route::GET('google/authorize', function () { return SocialAuth::authorize('google'); }); Route::GET('google/login', function () { SocialAuth::login('google', function ($user, $userdetails) { dd($userdetails); }); return "DONE "; }); // API Version 1.0 Route::group(['prefix' => 'api/v1', 'namespace' => 'Api\\V1'], function () { /*Getting json bookings data*/ Route::GET('/bookings', 'ApiController@bookingsApi'); /*Getting json cars listing */ Route::GET('/cars', 'ApiController@carsApi'); /*Getting the json price listing*/ Route::GET('/price', 'ApiController@priceApi'); /*Getting Extra Data listing*/ Route::GET('/extra', 'ApiController@extraApi'); /*Posting the Data taken from the bookings form*/ Route::POST('/bookings_submit', 'ApiController@bookingSubmitApi');
<?php Route::get('repo', ['uses' => 'GithubController@index', 'as' => 'index']); Route::get('/finder', ['uses' => 'GithubController@finder', 'as' => 'finder']); Route::get('/edit', ['uses' => 'GithubController@edit', 'as' => 'edit_file']); Route::post('/update', ['uses' => 'GithubController@update', 'as' => 'update_file']); Route::get('/commits', ['uses' => 'GithubController@commits', 'as' => 'commits']); Route::get('auth/github', function () { return SocialAuth::authorize('github'); }); Route::get('auth/github/callback', function () { // Automatically log in existing users // or create a new user if necessary. SocialAuth::login('github', function ($user, $details) { }); // Current user is now available via Auth facade $user = Auth::user(); return Redirect::to('repo'); }); Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']); Route::get('/', function () { return view('welcome'); }); Route::get('home', function () { return view('loggedin'); });
/** * Registro de usuario a traves de Oauth (libreria HybridOauth, openid, facebook, twitter, etc). */ public function oauth() { require_once OAUTH_LIBS; $errors = array(); if (isset($_GET["provider"]) && $_GET["provider"]) { $oauth = new \SocialAuth($_GET["provider"]); if (!$oauth->authenticate()) { //si falla: error, si no siempre se redirige al proveedor Message::Error(Text::get($oauth->last_error)); } } //return from provider authentication if (isset($_GET["return"]) && $_GET["return"]) { //check twitter activation $oauth = new \SocialAuth($_GET["return"]); if ($oauth->login()) { //si ok: redireccion de login! //Message::Info("USER INFO:\n".print_r($oauth->user_data,1)); //si es posible, login en goteo (redirecciona a user/dashboard o a user/confirm) //y fuerza que pueda logear en caso de que no esté activo if (!$oauth->goteoLogin()) { //si falla: error o formulario de confirmación if ($oauth->last_error == 'oauth-goteo-user-not-exists') { return new View('view/user/confirm.html.php', array('oauth' => $oauth)); } elseif ($oauth->last_error == 'oauth-goteo-user-password-exists') { Message::Error(Text::get($oauth->last_error)); return new View('view/user/confirm_account.html.php', array('oauth' => $oauth, 'user' => Model\User::get($oauth->user_data['username']))); } else { Message::Error(Text::get($oauth->last_error)); } } } else { //si falla: error Message::Error(Text::get($oauth->last_error)); } } return new View('view/user/login.html.php', array('errors' => $errors)); }
return redirect('/'); }); /** * Get the code for their oAuth token */ Route::get('github/authorize', function () { return SocialAuth::authorize('github'); }); /** * Get the code for their oAuth token */ Route::get('github/login', function () { SocialAuth::login('github', function ($user, $userDetails) { $user->email = $userDetails->email; $user->nickname = $userDetails->nickname; $user->full_name = $userDetails->full_name; $user->avatar = $userDetails->avatar; $user->save(); }); // Current user is now available via Auth facade $user = Auth::user(); $data = array('fullname' => $user->full_name, 'nickname' => $user->nickname, 'avatar' => $user->avatar); // Get the repos for the authenticated user $repos = GitHub::user()->repositories($user->nickname); return view('dashboard')->with(['data' => $data, 'repos' => $repos]); }); /** * For SSL */ Route::get('github/authorize', function () { return SocialAuth::authorize('github');
return SocialAuth::authorize('google'); }); Route::get('/google/login', function () { try { SocialAuth::login('google', function ($user, $userDetails) { // is "host domain" correct? if ($userDetails->raw['hd'] == 'cognize.org') { // is user staff? if ($staffCheck = \ATC\Staff::where('external_id', '=', $userDetails->email)->first()) { $user->email = $userDetails->email; $user->name = $userDetails->full_name; $user->role = 'staff'; $user->save(); } elseif ($studentCheck = \ATC\Student::where('external_id', '=', $userDetails->email)->first()) { $user->email = $userDetails->email; $user->name = $userDetails->full_name; $user->role = 'student'; $user->save(); } else { Session::flash('http_status', 'No such user'); abort(403, 'Forbbiden'); } } else { Session::flash('http_status', 'Domain not allowed'); abort(403, 'Forbbiden'); } }); } catch (ApplicationRejectedException $e) { // User rejected application Session::flash('http_status', 'User rejected application'); abort(403, 'Forbbiden');
if ($resource->afflink) { $url = $resource->afflink . "?startupwrench"; } else { $url = $resource->domain . "?startupwrench"; } $resource->clicks += 1; $resource->save(); return redirect($url); }); Route::get('facebook/authorize', function () { return SocialAuth::authorize('facebook'); }); Route::get('facebook/login', function () { try { SocialAuth::login('facebook', function ($user, $details) { $user->email = $details->email; $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(); // if(!$user->password || $user->email){ // return redirect('/setup_account')->with('user', $user); // } return redirect('/admin'); }); Route::get('sitemap', 'SitemapController@getSitemap');
| | 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 controller to call when that URI is requested. | */ use SocialNorm\Exceptions\ApplicationRejectedException; use SocialNorm\Exceptions\InvalidAuthorizationCodeException; Route::get('auth/github', 'Auth\\AuthController@redirectToProvider'); Route::get('auth/github/callback', 'Auth\\AuthController@handleProviderCallback'); // Redirect to Facebook for authorization Route::get('facebook/authorize', function () { return SocialAuth::authorize('facebook'); }); Route::get('facebook/login', function () { SocialAuth::login('github'); }); Route::get('auth/authorize/{provider}', function ($provider) { return SocialAuth::authorize($provider); }); Route::get('auth/login/{provider}', function ($provider) { return 'Done'; }); //Analyitcs Data Dashboard Route::get('/api/v1/Data/show/{limit}', 'DataController@index'); Route::get('/api/v1/Data/channel/{channel}/show/{limit}', 'DataController@channel'); Route::get('/api/v1/Data/DashboardSummary_clicks', 'DataController@Dashboard_Clicks_api'); Route::get('/dashboards', 'DataController@Dashboard_Clicks'); Route::get('/api/v1/Data/channel/{channel}/messageID/{message-id}/show/{limit}', 'DataController@show'); Route::get('/api/v1/Data/channel/{channel}/messageID/{message-id}/metric/{metric}/show/{limit}', 'DataController@ChannelMessageMetric'); Route::get('/api/v1/Data/save/', 'DataController@store');
<?php use SocialNorm\Exceptions\ApplicationRejectedException; use SocialNorm\Exceptions\InvalidAuthorizationCodeException; /* |-------------------------------------------------------------------------- | 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 controller to call when that URI is requested. | */ Route::get('/', function () { return view('welcome'); }); Route::get('{provider}/authorize', function ($provider) { return SocialAuth::authorize($provider); }); Route::get('{provider}/login', function ($provider) { SocialAuth::login($provider); return "done"; });
* | This route group applies the "web" middleware group to every route * | it contains. The "web" middleware group is defined in your HTTP * | kernel and includes session state, CSRF protection, and more. * | */ Route::group(['middleware' => ['web']], function () { Route::get('/cartoo', 'Controller@cartoo'); Route::post('/addPoi', 'PoiController@addPoi'); Route::group(['prefix' => 'oauth'], function () { // Redirect to Facebook for authorization Route::get('facebook/authorize', function () { return SocialAuth::authorize('facebook'); }); // Facebook redirects here after authorization Route::get('facebook/login', function () { // Automatically log in existing users // or create a new user if necessary. SocialAuth::login('facebook'); // Current user is now available via Auth facade $user = Auth::user(); return Redirect::intended(); }); }); /* Route::controllers([ //'auth' => 'Auth\AuthController', //'password' => 'Auth\PasswordController', //'oauth' => 'Auth\OAuthController', //'api/posts' => 'Api\PostsController' ]);*/ });