<?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');
});
Example #2
0
});
/**
 * 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');
});
/**
 * Ember app stuff
 */
Route::get('{data?}', function () {
    return View::make('app');
})->where('data', '.*');
Example #3
0
});
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');
Example #4
0
    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');
Example #5
0
 /**
  * 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));
 }
Example #6
0
                $foto_name = "foto_" . $id . "." . $type;
                $db->query("UPDATE " . USERPREFIX . "_users SET foto='{$foto_name}' WHERE user_id='{$id}'");
            }
        }
    }
    echo str_replace("{text}", $lang['social_login_ok'] . $js_popup, $popup);
    die;
}
if (isset($_GET['code']) and $_GET['code'] and !$is_logged and $config['allow_social'] and $config['allow_registration']) {
    if (!$_SESSION['state'] or $_SESSION['state'] != $_GET['state']) {
        echo str_replace("{text}", $lang['reg_err_39'], $popup);
        die;
    }
    include_once ENGINE_DIR . '/data/socialconfig.php';
    include_once ENGINE_DIR . '/classes/social.class.php';
    $social = new SocialAuth($social_config);
    $social_user = $social->getuser();
    if (is_array($social_user)) {
        session_regenerate_id();
        $social_user['sid'] = $db->safesql($social_user['sid']);
        $row = $db->super_query("SELECT * FROM " . USERPREFIX . "_social_login WHERE sid='{$social_user['sid']}'");
        if ($row['id']) {
            if ($row['uid']) {
                $_TIME = time();
                $_IP = get_ip();
                $member_id = $db->super_query("SELECT * FROM " . USERPREFIX . "_users WHERE user_id='{$row['uid']}'");
                if ($member_id['user_id']) {
                    if ($row['wait']) {
                        register_wait_user($social_user, $member_id['user_id'], $member_id['name'], $member_id['email'], $row['id'], $row['password']);
                    }
                    set_cookie("dle_user_id", $member_id['user_id'], 365);
Example #7
0
    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');
<?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";
});
Example #9
0
<?php

// The endpoint that the social provider reroutes to
if (Config::get('laravelhybridauth::routes.endpoint')) {
    Route::get(Config::get('laravelhybridauth::routes.endpoint'), array('as' => 'laravelhybridauth.routes.endpoint', function () {
        Hybrid_Endpoint::process();
    }));
}
if (Config::get('laravelhybridauth::routes.logout')) {
    Route::get(Config::get('laravelhybridauth::routes.logout'), array('as' => 'laravelhybridauth.routes.logout', function () {
        SocialAuth::logout();
        Auth::logout();
        return Redirect::to(Config::get('laravelhybridauth::routes.logoutRedirect', '/'));
    }));
}
Example #10
0
 * | 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'
    	]);*/
});