public function getGoogleLogin($auth = NULL)
{
if ($auth == 'auth') {
Hybrid_Endpoint::process();
}
try {
$oauth = new Hybrid_Auth(app_path() . '/config/google_auth.php');
$provider = $oauth->authenticate('Google');
$profile = $provider->getUserProfile();
} catch (exception $e) {
return $e->getMessage();
}
if ($user = User::where('email', '=', $profile->email)->first()) {
Auth::login($user, true);
return Redirect::intended('/');
}
return App::make('frontend\\UserController')->doSignUp(array('email' => $profile->email, 'login' => $profile->identifier, 'password' => "pass1234", 'f_name' => $profile->firstName, 'l_name' => $profile->lastName));
}