Esempio n. 1
0
 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     Session::forget('customer_id');
     Session::forget('customer_name');
     $this->auth->logout();
     return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
 }
Esempio n. 2
0
 /**
  * Redirect back or to a saved URL if any.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 protected function redirectBackWithSession()
 {
     if ($redirect = Session::get('redirect')) {
         Session::forget('redirect');
         return Redirect::to($redirect);
     }
     return Redirect::back();
 }
Esempio n. 3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     Session::forget('UniversityHistory');
     Session::forget('CareerHistory');
     //$this->convertScript();
     $people = DB::table("Employee")->select("People.id_People", "People.First_Name", "People.Middle_Name", "People.Surname", "Career_History.Company_Name", DB::raw("GROUP_CONCAT(Employee_Type.Type_Name ORDER BY Type_Name DESC SEPARATOR ',') as Position"))->leftJoin("People", "Employee.id_People", "=", "People.id_People")->leftJoin("Employee_Employee_Types", "Employee.id_Employee", "=", "Employee_Employee_Types.id_Employee")->leftJoin("Employee_Type", "Employee_Employee_Types.id_Employee_Type", "=", "Employee_Type.id_Employee_Type")->leftJoin("Career_History", "People.id_People", "=", "Career_History.id_People")->whereNull("People.Deleted")->where("Career_History.Current_Position_Status", "=", 1)->groupBy("Employee.id_Employee")->get();
     return view("admin.employee.index", compact("people"));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     Session::forget('UniversityHistory');
     Session::forget('CareerHistory');
     $this->convertScript();
     $people = People::whereNull("Deleted")->get()->sortBy("First_Name");
     return view("admin.employee.index", compact("people"));
 }
 /**
  * {@inheritDoc}
  */
 public function clear($key)
 {
     if (!in_array($key, self::$validKeys)) {
         throw new LinkedInApiException(sprintf('Unsupported key ("%s") passed to clear.', $key));
     }
     $name = $this->constructSessionVariableName($key);
     return Session::forget($name);
 }
 public function getLogin()
 {
     return redirect()->action('HomeController@getGameOver');
     Session::forget('profileId');
     $fb = App::make('SammyK\\LaravelFacebookSdk\\LaravelFacebookSdk');
     $data = array('selectedPage' => 2, 'fbLink' => $fb->getLoginUrl(['email']));
     return view('register.fblogin', $data);
 }
Esempio n. 7
0
 public function clear()
 {
     Session::forget($this->config['AUTH_SESSION_PREFIX'] . 'uid');
     Session::forget($this->config['AUTH_SESSION_PREFIX'] . 'role_id');
     if (Session::has($this->config['AUTH_SESSION_PREFIX'] . 'power')) {
         Session::forget($this->config['AUTH_SESSION_PREFIX'] . 'power');
     }
     $this->dsetcookie('cdata', '', Carbon::now()->getTimestamp() - 3600, $this->config['AUTH_COOFIKE_PREFIX'], '/', '', true);
 }
Esempio n. 8
0
 public function clear()
 {
     $product = new Product();
     $cart = Session::get("cart");
     foreach ($cart as $id => $quantity) {
         $product->restIncrement($id, $quantity);
     }
     Session::forget("cart");
 }
Esempio n. 9
0
 public static function logOut()
 {
     Session::forget("user_id");
     Session::forget("role");
     Session::forget("project_id_profile_u");
     Session::forget("superuser");
     Session::flush();
     Redirect::to('login')->send();
 }
Esempio n. 10
0
 /**
  *
  */
 public function logout()
 {
     if (Session::has('oauth')) {
         /** @var TokenHelper $tokenHelper */
         $tokenHelper = App::make(TokenHelper::class);
         $tokenHelper->deleteTokens(Session::get('oauth.access_token'));
         Session::forget('oauth');
     }
 }
Esempio n. 11
0
 public function deconnexion()
 {
     if (Session::has('admin')) {
         Session::forget('admin');
     } else {
         Session::forget('etudiant');
     }
     return Redirect::to('/');
 }
Esempio n. 12
0
 public function logout()
 {
     if (!Session::has('user')) {
         return Redirect::to('/');
     } else {
         Session::forget('user');
         return Redirect::to('/');
     }
 }
Esempio n. 13
0
 public function index()
 {
     $app_id = Config::get('registration::social.fb.api_id');
     $app_secret = Config::get('registration::social.fb.secret_key');
     $my_url = "http://" . $_SERVER['HTTP_HOST'] . "/auth_soc/face_res";
     $code = Input::get("code");
     $state = Input::get("state");
     if (empty($code)) {
         Session::put('state', md5(uniqid(rand(), TRUE)));
         $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&scope=public_profile,publish_actions,email&state=" . Session::get('state') . "&fields=email,first_name,last_name,id,gender";
         header("Location: {$dialog_url}");
     }
     if ($state == Session::get('state')) {
         $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret=" . $app_secret . "&code=" . $code . "&fields=email,first_name,last_name,id,gender";
         $response = file_get_contents($token_url);
         $params = null;
         parse_str($response, $params);
         $graph_url = "https://graph.facebook.com/me?access_token=" . $params['access_token'] . "&fields=email,first_name,last_name,id,gender";
         $user = json_decode(file_get_contents($graph_url));
         $first_name = $user->first_name;
         $last_name = $user->last_name;
         $fb_id = $user->id;
         if (isset($user->email)) {
             $user_email = $user->email;
         } else {
             $user_email = $fb_id;
         }
         //проверка юзера
         if ($user_email && $fb_id) {
             $user = DB::table("users")->where("id_fb", $fb_id)->first();
             if (!$user['id']) {
                 $user = DB::table("users")->where("email", "like", $user_email)->first();
             }
             if (!$user['id']) {
                 $new_pass = str_random(6);
                 $user = Sentry::register(array('email' => $user_email, 'password' => $new_pass, 'id_fb' => $fb_id, 'activated' => "1", 'first_name' => $first_name, 'last_name' => $last_name));
                 $user_auth = Sentry::findUserById($user->id);
                 Sentry::login($user_auth, Config::get('registration::social.fb.remember'));
             } else {
                 $user_auth = Sentry::findUserById($user['id']);
                 Sentry::login($user_auth, Config::get('registration::social.fb.remember'));
             }
             $redirect = Session::get('url_previous', "/");
             Session::forget('url_previous');
             //if not empty redirect_url
             if (Config::get('registration::social.fb.redirect_url')) {
                 $redirect = Config::get('registration::social.fb.redirect_url');
                 Session::flash('id_user', $user_auth->id);
             } else {
                 $redirect = Session::get('url_previous', "/");
                 Session::forget('url_previous');
             }
             return Redirect::to($redirect);
         }
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Session::has('breadcrumb_titles')) {
         Session::forget('breadcrumb_titles');
     }
     if (Session::has('breadcrumb_links')) {
         Session::forget('breadcrumb_links');
     }
     return $next($request);
 }
Esempio n. 15
0
 /**
  * Logout website.
  *
  * @return mixed
  */
 public function getLogout()
 {
     Session::forget('user');
     if (!Session::has('auth')) {
         return Redirect::to('/auth');
     } else {
         Flash::error('登出失败');
         return Redirect::back();
     }
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('hardywen/social-login');
     $config = $this->app->config->get('social-login::config');
     if ($config['auto_logout']) {
         Event::listen('auth.logout', function () {
             Session::forget("social_login");
         });
     }
 }
 /**
  * Register events for this service provider.
  *
  * @return void
  */
 public function registerEvents()
 {
     //Store the Kinvey auth token in the user's session, and clear it on logout.
     Event::listen('auth.login', function ($user) {
         Session::put('kinvey', $user->_kmd['authtoken']);
     });
     Event::listen('auth.logout', function ($user) {
         Session::forget('kinvey');
     });
 }
Esempio n. 18
0
 /**
  * This method is used to logout from CAS
  *
  * @param array ['url' => 'http://...'] || ['service' => ...]
  *
  * @return none
  */
 public function logout($params = [])
 {
     if (!phpCAS::isAuthenticated()) {
         $this->initialize();
     }
     if (Session::has('cas_user')) {
         Session::forget('cas_user');
     }
     phpCAS::logout($params);
 }
Esempio n. 19
0
 public function index()
 {
     if (Input::get("code")) {
         $api_id = Config::get('registration::social.vk.api_id');
         $secret_key = Config::get('registration::social.vk.secret_key');
         $params = array('client_id' => $api_id, 'client_secret' => $secret_key, 'code' => Input::get("code"), 'redirect_uri' => "http://" . $_SERVER['HTTP_HOST'] . "/auth_soc/vk_res");
         $url = 'https://oauth.vk.com/access_token' . '?' . urldecode(http_build_query($params));
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         $result = curl_exec($ch);
         curl_close($ch);
         $data = json_decode($result, true);
         if (isset($data['access_token'])) {
             $str = "https://api.vkontakte.ru/method/getProfiles?uid=" . $data['user_id'] . "&fields=photo_big&access_token=" . $data['access_token'];
             $resp2 = file_get_contents($str);
             $el = json_decode($resp2, true);
             $first_name = $el['response'][0]['first_name'];
             $last_name = $el['response'][0]['last_name'];
             $id_user = $el['response'][0]['uid'];
             $user = DB::table("users")->where("id_vk", $id_user)->first();
             if (!isset($user['id'])) {
                 $new_pass = str_random(6);
                 $user = Sentry::register(array('email' => $id_user, 'password' => $new_pass, 'id_vk' => $id_user, 'activated' => "1", 'first_name' => $first_name, 'last_name' => $last_name));
                 //качаем аватарку юзера
                 if ($el['response'][0]['photo_big'] && Config::get('registration::social.vk.foto')) {
                     $id_one = substr($user->id, 0, 1);
                     $destinationPath = "/storage/users/{$id_one}/{$user->id}/";
                     $path_server = public_path() . $destinationPath;
                     File::makeDirectory($path_server, $mode = 0777, true, true);
                     $foto_resource = file_get_contents($el['response'][0]['photo_big']);
                     $foto_user = time() . basename($el['response'][0]['photo_big']);
                     $f = fopen($_SERVER['DOCUMENT_ROOT'] . $destinationPath . $foto_user, 'w');
                     fwrite($f, $foto_resource);
                     fclose($f);
                     $user->photo = $destinationPath . $foto_user;
                     $user->save();
                 }
                 $user_auth = Sentry::findUserById($user->id);
                 Sentry::login($user_auth, Config::get('registration::social.vk.remember'));
             } else {
                 $user_auth = Sentry::findUserById($user['id']);
                 Sentry::login($user_auth, Config::get('registration::social.vk.remember'));
             }
             //if not empty redirect_url
             if (Config::get('registration::social.vk.redirect_url')) {
                 $redirect = Config::get('registration::social.vk.redirect_url');
                 Session::flash('id_user', $user_auth->id);
             } else {
                 $redirect = Session::get('url_previous', "/");
                 Session::forget('url_previous');
             }
             return Redirect::to($redirect);
         }
     }
 }
Esempio n. 20
0
 public function success(Buckaroo $buckaroo, Request $request)
 {
     $order = Order::find($buckaroo->invoice_nr(Request::all()));
     $order->payed = 1;
     $order->saveitems(Cart::content());
     $order->save();
     $event = Event::fire(new ItemsPurchasedEvent($order, Cart::content()));
     Session::forget('order');
     Cart::destroy();
     return view("shoppingcart.payment-success");
 }
Esempio n. 21
0
 public function postSearchBarrio(RequestHttp $request)
 {
     $this->validate($request, ['postal_code' => 'required|max:5|min:5']);
     $barrio = Barrio::where('postal_code', '=', Request::input('postal_code'))->first();
     if (!$barrio) {
         Session::forget('barrio_search');
         return redirect('not-found');
     }
     Session::put('barrio_search', $barrio);
     return redirect($barrio['url_name']);
 }
Esempio n. 22
0
 public static function display()
 {
     BootAlert::$bootAlertTemplate = Config::get('bootalert::alert.template');
     $alerts = "";
     foreach (Session::get('__maku_bootalert', array()) as $alert) {
         $alerts .= BootAlert::parseAlert($alert);
     }
     Session::forget('__maku_bootalert');
     //We are already displayed this alerts - we no should display they again
     return $alerts;
 }
Esempio n. 23
0
 public function signOut()
 {
     Session::forget('email');
     Session::forget('name');
     Session::forget('username');
     Session::forget('birthdate');
     Session::forget('gender');
     Session::forget('language');
     Session::forget('timezone');
     return redirect(config('sol.logoutRedirect', '/'));
 }
Esempio n. 24
0
 public function index()
 {
     $orderData = Session::get('order_data');
     $orderProductData = Session::get('cart');
     $orderStatus = OrderStatus::where('is_default', '=', 1)->get()->first();
     $orderData['order_status_id'] = $orderStatus->id;
     $order = Order::create($orderData);
     $this->syncOrderProductData($order, $orderProductData);
     Session::forget('cart');
     Session::forget('order_data');
     return redirect()->route('order.success', $order->id);
 }
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     $events->listen('Illuminate\\Auth\\Events\\Login', function () {
         $login_data = ['login_time' => Carbon::now()];
         User::where('id', Auth::user()->id)->update(['last_login' => Carbon::now()]);
         userDetail::where('user_id', Auth::user()->id)->update($login_data);
         $login_user_detail = User::where('id', Auth::user()->id)->get();
         foreach ($login_user_detail as $val) {
             $user_detail_array = ['user_id' => $val->id, 'user_type' => $val->user_type, 'name' => $val->name, 'email' => $val->email];
         }
         if ($user_detail_array['user_type'] == 'attorney') {
             $session_array = ['attorney_session_array' => ['user_id' => $user_detail_array['user_id'], 'user_type' => $user_detail_array['user_type'], 'name' => $user_detail_array['name'], 'email' => $user_detail_array['email']]];
         } elseif ($user_detail_array['user_type'] == 'client') {
             $session_array = ['client_session_array' => ['user_id' => $user_detail_array['user_id'], 'user_type' => $user_detail_array['user_type'], 'name' => $user_detail_array['name'], 'email' => $user_detail_array['email']]];
         } elseif ($user_detail_array['user_type'] == 'admin') {
             $session_array = ['admin_session_array' => ['user_id' => $user_detail_array['user_id'], 'user_type' => $user_detail_array['user_type'], 'name' => $user_detail_array['name'], 'email' => $user_detail_array['email']]];
         } else {
             $session_array = ['session' => 'null'];
         }
         //Save session of login user
         Session::put($session_array);
         //Fetch session of login user
         //            if( Session::has('admin_session_array') ){
         //                $AdminSession = Session::get( 'admin_session_array' );
         //                //dd($AdminSession);
         //            }elseif(Session::has('client_session_array')){
         //                 $ClientSession = Session::get( 'client_session_array' );
         //                //dd($ClientSession);
         //            }elseif(Session::has('attorney_session_array')){
         //                 $AttorneySession = Session::get( 'attorney_session_array' );
         //              //dd($AttorneySession);
         //            }else{
         //                 $DefaultSession = Session::get( 'session' );
         //            }
     });
     $events->listen('Illuminate\\Auth\\Events\\Logout', function () {
         $login_user_detail = User::where('id', Auth::user()->id)->get();
         foreach ($login_user_detail as $val) {
             $user_detail_array = ['user_type' => $val->user_type];
         }
         if ($user_detail_array['user_type'] == 'client') {
             Session::forget('client_session_array');
         } elseif ($user_detail_array['user_type'] == 'attorney') {
             Session::forget('attorney_session_array');
         } elseif ($user_detail_array['user_type'] == 'admin') {
             Session::forget('admin_session_array');
         } else {
             //
         }
     });
 }
Esempio n. 26
0
 /**
  * Function to get view profile
  * @return view
  */
 public function getProfile()
 {
     $barrio = Barrio::where('postal_code', '=', Auth::user()->postal_code)->first();
     if ($barrio) {
         Session::put('barrio', $barrio);
     } else {
         Session::forget('barrio');
     }
     $data = [];
     $data['general'] = 1;
     $data['dashboardAuth'] = 1;
     return view('frontend.account.profile', $data);
 }
 public function searchUser(Request $request)
 {
     Session::forget('message');
     $search = $request->input('searchUser');
     $n = User::whereNotIN('id', [Auth::user()->id])->where('username', 'like', "%" . $search . "%")->count();
     if ($n < 1) {
         Session::flash('message', 'Not Found');
         return view('admin.userinfo');
     } else {
         $users = User::where('username', 'like', "%" . $search . "%")->whereNotIN('id', [Auth::user()->id])->paginate(10);
         $users->setPath('/searchuser');
         return view('admin.userinfo')->with(['users' => $users, 'requestSave' => $search]);
     }
 }
Esempio n. 28
0
 public function testMetaDataStorage()
 {
     include 'source/helper.php';
     $meta = laravel_ab_meta();
     Session::forget(config('laravel-ab.cache_key'));
     Session::flush();
     $ab = app()->make('Ab');
     $ab->forceReset();
     Ab::saveSession();
     $instance = Instance::where(['instance' => Ab::getSession()->instance])->get()->first();
     $metadata = $instance->metadata;
     $this->assertTrue(is_array($metadata));
     $this->assertEquals($metadata, $meta);
 }
Esempio n. 29
0
 /**
  * Ajout de $secret en DB et activation l'authentification à 2 facteurs
  */
 public function totp_post(Request $request)
 {
     $otp = new Otp();
     $secret = session()->get('secret');
     $key = $request->get("code");
     $user = $this->auth->user();
     if ($otp->checkTotp(Base32::decode($secret), $key)) {
         DB::table('users')->where('id', $user->id)->update(array('totp_key' => $secret));
         Session::forget('code');
         return redirect(url('profil'))->with('success', 'L\'authentification à 2 facteurs à bien été activer');
     } else {
         return redirect(url('profil/totp'))->with('error', 'Ce code ne correspond pas, veuillez recommencer l\'opération');
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $searchFilters = ["Company_Full_Name"];
     $paginationList = [];
     $activePage = $request->page ? $request->page : null;
     $companiesSearchBy = Companies::getCompaniesSearchBy();
     $companiesList = DB::table('Company')->where("Deleted", "=", NULL)->orderBy('Company_Full_Name', 'asc');
     foreach ($companiesList->get() as $company) {
         if (strlen($company->Company_Full_Name)) {
             $firstChar = strtolower(substr($company->Company_Full_Name, 0, 1));
             if (!isset($paginationList[$firstChar])) {
                 $paginationList[$firstChar] = 0;
             }
             $paginationList[$firstChar] += 1;
         }
     }
     $companies = DB::table('Company')->select('Company.id_Company', 'Company.Company_Full_Name', 'Company.Year_Founded', 'Company.Website', 'Company.id_Employee_Size', 'Employee_Size.Employee_Size', 'Addresses.City', 'Addresses.State', 'Country.Country', 'Revenue_Stage.Revenue_Stage', 'Company.Is_Published')->leftJoin('Employee_Size', 'Company.id_Employee_Size', '=', 'Employee_Size.id_Employee_Size')->leftJoin('Headquarters_Information', 'Company.id_Company', '=', 'Headquarters_Information.id_Company')->leftJoin('Addresses', 'Headquarters_Information.AddressId', '=', 'Addresses.AddressId')->leftJoin('Country', 'Addresses.id_Country', '=', 'Country.id_Country')->leftJoin('Revenue_Stage', 'Company.id_Revenue_Stage', '=', 'Revenue_Stage.id_Revenue_Stage')->whereNull("Deleted")->groupBy("Headquarters_Information.AddressId")->groupBy("Company.id_Company")->orderBy('Company_Full_Name', 'asc');
     if (!is_null($activePage) && $activePage != "all") {
         $companies->where("Company_Full_Name", "like", "{$activePage}%");
     }
     //$products = Products::all();
     $products = Products::whereNull("Deleted")->get();
     $employeeSize = EmployeeSize::all();
     $ProductsToShow = [];
     $ProductsToHide = [];
     foreach ($companies->get() as $company) {
         $ProductsToShow[$company->id_Company] = [];
         $ProductsToHide[$company->id_Company] = [];
         $itemQty = 0;
         foreach ($products as $product) {
             if ($product->id_Owner_Company == $company->id_Company) {
                 $itemQty++;
                 if ($itemQty > 1) {
                     $ProductsToHide[$company->id_Company][] = ["id" => $product->id_Product, "title" => $product->Product_Title];
                     //link_to(URL::route("admin.products.edit", $product->id_Product), $product->Product_Title, ["target"=>"_blank"]);
                 } else {
                     $ProductsToShow[$company->id_Company][] = ["id" => $product->id_Product, "title" => $product->Product_Title];
                 }
             }
         }
     }
     //$companies = Paginator::make($companies, $companies->count(), 15);
     // empty session data
     Session::forget('CompanySearch');
     Session::forget('SearchFilters');
     Session::forget('MediaContacts');
     Session::forget('CompanyAttachments');
     return view("admin.companies.index", compact('companies', "ProductsToHide", "ProductsToShow", "search", "employeeSize", "searchFilters", "paginationList", "activePage", "companiesSearchBy"));
 }