Esempio n. 1
0
 public function postAdd()
 {
     $title = 'Proceso de daño';
     $cart = array();
     $input = Input::all();
     if (Session::has('cart')) {
         $cart = Session::get('cart');
     }
     if (empty($cart)) {
         return Redirect::to('damages');
     }
     foreach ($cart as $item) {
         $check = Article::checkStock($item['article'], $input['branch_id'], $item['amount'], 'daño');
         /*Comprueba si hay suficiente stock en la sucursal*/
         if ($check != 'Ok') {
             Session::flash('message', $check);
             return Redirect::to('cart');
         }
     }
     /*Crea el registro en la tabla damages*/
     self::saveInDamageTable();
     /*Crea los registros en la tabla damage_items*/
     foreach ($cart as $item) {
         self::saveInDamageItemTable($item['article']->id, $item['amount']);
     }
     #foreach $cart as $item
     /*Vacía el carrito*/
     Session::forget('cart');
     return Redirect::to('damages');
 }
Esempio n. 2
0
 /**
  * Start test
  */
 public function startIndexAction()
 {
     Assets::reset()->add('main');
     $token = $this->getToken();
     if (!$token) {
         return Redirect::route('info')->with('message', 'Токен не найден');
     }
     if ($token->status == Token::TOKEN_STATUS_EMPTY) {
         /**
          * вывести форму где пользователь введёт свои данные
          */
         $departments = Department::all();
         $groups = Group::all();
         $selectedDepartments = array();
         $selectGroups = array();
         $selectedDepartments[] = 'Не выбран';
         $selectGroups[] = 'Не выбран';
         foreach ($departments as $department) {
             $selectedDepartments[$department->id] = $department->name;
         }
         foreach ($groups as $group) {
             $selectGroups[$group->id] = $group->name;
         }
         return View::make('test.start', ['token' => $token, 'departments' => $selectedDepartments, 'groups' => $selectGroups]);
     } elseif ($token->status == Token::TOKEN_STATUS_STARTED) {
         if ($this->isTokenValid($token)) {
             return Redirect::route('test.index');
         } else {
             Session::forget('token_string');
             $token->status = Token::TOKEN_STATUS_EXPIRED;
             $token->save();
             return Redirect::route('info')->with('message', 'Время теста истекло');
         }
     }
 }
 public function logout()
 {
     Session::forget('ltime');
     Session::forget('sescode');
     Auth::logout();
     return Response::json(array('flash' => 'Logged Out !'));
 }
Esempio n. 4
0
 public function postAdd()
 {
     $title = 'Proceso de entrega inmediata';
     $cart = array();
     $input = Input::all();
     $idBranch = Auth::user()->roles()->first()->branch->id;
     if (Session::has('cart')) {
         $cart = Session::get('cart');
     }
     if (empty($cart)) {
         return Redirect::to('instants');
     }
     foreach ($cart as $item) {
         $check = Article::checkStock($item['article'], Auth::user()->roles()->first()->branch->id, $item['amount'], 'entrega inmediata');
         /*Comprueba si hay suficiente stock en la sucursal*/
         if ($check != 'Ok') {
             Session::flash('message', $check);
             return Redirect::to('cart');
         }
     }
     /*Crea el registro en la tabla instants*/
     self::saveInInstantTable();
     /*Crea los registros en la tabla instant_items*/
     foreach ($cart as $item) {
         self::saveInInstantItemTable($item['article']->id, $item['amount']);
     }
     #foreach $cart as $item
     /*Disminuye el campo stock en la tabla stocks*/
     $instant_id = Instant::first()->orderBy('created_at', 'desc')->first()->id;
     self::saveInInstantStore($instant_id);
     /*Vacía el carrito*/
     Session::forget('cart');
     return Redirect::to('instants');
 }
Esempio n. 5
0
 /**
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Dvlpp\Sharp\Exceptions\MandatoryClassNotFoundException
  */
 public function logout()
 {
     $authService = SharpSiteConfig::getAuthService();
     $authService->logout();
     Session::forget("sharp_user");
     return redirect()->to("/");
 }
Esempio n. 6
0
 public function Login()
 {
     $user = Input::get('username');
     $pass = Input::get('password');
     $validar_ldap = $this->ValidarLDAP($user, $pass);
     switch ($validar_ldap) {
         case "ERROR_LOGIN":
             Session::put('error', 'Login Incorrecto');
             Session::forget('username');
             break;
         case "ACCESO_NEGADO":
             Session::put('error', 'Acceso Denegado');
             Session::forget('username');
             break;
         default:
             Session::forget('error');
             Session::put('username', $validar_ldap);
             $userinfo = explode("|", $validar_ldap);
             $nickname = $userinfo[1];
             Session::put('NickNameUsuario', $nickname);
             Session::put('activity', time());
             break;
     }
     if (Session::get('username') && Session::get('username') != '') {
         return Redirect::route('index');
     } else {
         return Redirect::route('login', array('error' => Session::get('error')));
     }
 }
Esempio n. 7
0
 public function getLogout()
 {
     Session::forget("logined");
     Session::forget("role");
     //Xóa session đăng nhập
     return Redirect::to("/");
 }
Esempio n. 8
0
 /**
  * Process login, only for POST http method
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function login()
 {
     /**
      * Get input values
      */
     $credentials = array('username' => Input::get('username'), 'password' => Input::get('password'));
     /**
      * Get remember me checkbox value ('on' or null)
      */
     $rememberme = Input::get('rememberme', false);
     /**
      * Check username or password is not empty
      */
     if ($credentials['username'] == '' or $credentials['password'] == '') {
         return Redirect::route('login')->withInput(Input::except('password'))->with('error', 'Username or password cannot be blank');
     }
     /**
      * Attempt to authenticate
      */
     if (Auth::attempt($credentials, $rememberme)) {
         /**
          * Get session variable 'redirect' for previous page
          */
         if ($url = Session::get('redirect', false)) {
             Session::forget('redirect');
             return Redirect::to($url);
         }
         return Redirect::refresh();
     }
     /**
      * If authentication failed, redirect to login page
      */
     return Redirect::route('login')->withInput(Input::except('password'))->with('error', 'Wrong username or password');
 }
 public function postNueva()
 {
     try {
         if (!Session::has('cliente')) {
             Session::flash('mensajeError', 'Debes seleccionar un cliente para continuar.');
             return Redirect::to('carrito');
         }
         $input = Input::all();
         $cotizacion = new Cotizacion();
         $cotizacion->cliente_id = Session::get('cliente')->id;
         $cotizacion->concepto = $input['concepto'];
         $cotizacion->notas = $input['notas'];
         $cotizacion->user_id = Auth::user()->id;
         $cotizacion->save();
         if (self::guardarItems($cotizacion->id) === false) {
             $cotizacion->delete();
             Session::flash('mensajeError', 'No fue posible guardar la cotización por uno de sus items.');
             return Redirect::to('carrito');
         }
         Session::forget('carrito');
         Session::forget('cliente');
         Session::flash('mensajeOk', 'Has creado la cotizacion ' . $cotizacion->id . ' con éxito.');
         return Redirect::to('cotizaciones/filtro-por-id/' . $cotizacion->id);
     } catch (Exception $e) {
         Session::flash('mensajeError', 'No fue posible guardar la nueva cotización.');
         return Redirect::to('carrito');
     }
 }
 public function saveProduct()
 {
     $data = Input::all();
     if (!Auth::guest()) {
         $validator = Validator::make($data, Product::$rules);
         if ($validator->passes()) {
             $user = Auth::user();
             $product = new Product();
             $product->user_id = $user->id;
             $product->product_name = $data['product_name'];
             $product->description = $data['description'];
             $product->start_price = $data['start_price'];
             $product->save();
             if (isset($data['categories']) && !empty($data['categories'])) {
                 $product->categories()->attach($data['categories']);
             }
             if (Session::has('files')) {
                 $files = Session::get('files');
                 // get session files
                 foreach ($files as $key => $file) {
                     $directory_file = public_path() . '/product_images/' . $file;
                     if (File::exists($directory_file)) {
                         File::move($directory_file, public_path() . '/product_images/product_' . $product->id . '_' . $key . '.jpg');
                     }
                 }
                 Session::forget('files');
             }
             return Response::json(array('success' => true, 'product' => $product));
         }
         return Response::json(array('success' => false, 'type' => 'form_error', 'errors' => $validator->messages()));
     }
     return Response::json(array('success' => false, 'type' => 'log_error', 'error' => 'In order to save your product, please, log in!'));
 }
Esempio n. 11
0
 function getLogout()
 {
     Session::forget('username');
     Session::forget('password');
     Auth::logout();
     return Redirect::to('/login');
 }
Esempio n. 12
0
 public function lock()
 {
     $prevURL = URL::previous();
     if (Request::ajax()) {
         $admin = Auth::admin()->get();
         if (!Input::has('password')) {
             $message = 'You must enter password to re-login.';
         } else {
             if (Hash::check(Input::get('password'), $admin->password)) {
                 Session::forget('lock');
                 Session::flash('flash_success', 'Welcome back.<br />You has been login successful!');
                 return ['status' => 'ok'];
             }
             $message = 'Your password is not correct.';
         }
         return ['status' => 'error', 'message' => $message];
     } else {
         if (Request::isMethod('get')) {
             Session::put('lock', true);
         }
     }
     if (empty($prevURL) || strpos($prevURL, '/admin/lock') !== false) {
         $prevURL = URL . '/admin';
     }
     return Redirect::to($prevURL);
 }
Esempio n. 13
0
 public static function logout()
 {
     Session::forget("auths");
     Cookie::forget(Config::get('auth.rememeber_cookie'));
     //
     //Url::redirect("@".Config::get('auth.login'));
 }
Esempio n. 14
0
 public function postAdd()
 {
     $title = 'Proceso de rotación';
     $cart = array();
     $input = Input::all();
     if (Session::has('cart')) {
         $cart = Session::get('cart');
     }
     if (empty($cart)) {
         return Redirect::to('rotations');
     }
     foreach ($cart as $item) {
         $check = Article::checkStock($item['article'], $input['branch_from'], $item['amount'], 'rotación');
         /*Comprueba si hay suficiente stock en la sucursal*/
         if ($check != 'Ok') {
             Session::flash('message', $check);
             return Redirect::to('cart');
         }
     }
     /*Crea el registro en la tabla rotations*/
     self::saveInRotationTable();
     /*Crea los registros en la tabla rotation_items*/
     foreach ($cart as $item) {
         self::saveInRotationItemTable($item['article']->id, $item['amount']);
     }
     #foreach $cart as $item
     /*Vacía el carrito*/
     Session::forget('cart');
     return Redirect::to('rotations/filter-by-status?estado=pendiente%');
 }
Esempio n. 15
0
 public function getLogout()
 {
     if (Session::has('kukki_user')) {
         Session::forget('kukki_user');
         return Redirect::to('site/login');
     }
 }
 public function do_login()
 {
     try {
         $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
         if (Input::get('remember') == 1) {
             $user = Sentry::authenticateAndRemember($credentials);
         } else {
             $user = Sentry::authenticate($credentials);
         }
         $url = Session::get('originalRequest') ? Session::get('originalRequest') : URL::to('dashboard');
         Session::forget('originalRequest');
         return Response::json(['success' => 'Login successful. You will now be redirected to the admin dashboard', 'url' => $url]);
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         return Response::json(['email' => 'Email is required']);
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         return Response::json(['password' => 'Password is required.']);
     } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
         return Response::json(['password' => 'Wrong password, please try again.']);
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         return Response::json(['email' => 'User not found.']);
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         return Response::json(['email' => 'User is not activated.']);
     } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
         return Response::json(['email' => 'User is suspended.']);
     } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
         return Response::json(['email' => 'User is banned.']);
     }
 }
Esempio n. 17
0
 public function delete()
 {
     if (Session::has('current_user')) {
         Session::forget('current_user');
     }
     return Redirect::to('/');
 }
Esempio n. 18
0
 public function logout()
 {
     Auth::logout();
     Session::forget('management');
     $is_json = Input::get('method') == 'json';
     return $is_json ? Response::json(['success' => true]) : Redirect::to('/');
 }
Esempio n. 19
0
 public function getLogout()
 {
     Session::forget('cod_user');
     Session::forget('nome_user');
     Session::forget('tipo_user');
     return Redirect::to("/login");
 }
Esempio n. 20
0
 public function confirmedCart()
 {
     //on récupère l'id du client
     $id = Session::get('client_id');
     //on trouve le client avec son id
     $user = User::find($id);
     //on charge les données pour la création de la commande
     $data = array('id_client' => $user->id);
     //on créer une nouvelle commande
     $commande = Commande::create($data);
     //on récupère les données de la session cart
     $cart_aray = Session::get('cart');
     foreach ($cart_aray as $c_array) {
         foreach ($c_array as $cart_line) {
             //on charge les données avant de créer une nouvelle ligne de commande
             $data = array('id_client' => $user->id, 'id_produit' => $cart_line['id'], 'quantite' => 1, 'id_command' => $commande->id);
             // pour chaque tour, on crée une nouvelle ligne de commande dans la base
             $ligne_commande = LigneCommande::create($data);
         }
     }
     //on supprime la session cart, et on la recrée vide.
     Session::forget('cart');
     Session::put('cart.items', '');
     return View::make('confirmed_cart');
 }
Esempio n. 21
0
 public function unsetUser()
 {
     if (\Session::has("User")) {
         \Session::forget("User");
         \Session::save();
     }
 }
 public function logOut()
 {
     Session::forget('datosCliente');
     $response = array('status' => 0, 'msj' => 'Ok');
     //echo json_encode($response);
     return Redirect::to('/');
 }
Esempio n. 23
0
 public function olvidarSesion()
 {
     \Session::forget("idUsuarioSesion");
     \Session::forget("nameUsuarioSesion");
     \Session::forget("cantArt");
     return \Redirect::to("/");
 }
 public function getPaymentStatus()
 {
     // Get the payment ID before session clear
     $payment_id = Session::get('paypal_payment_id');
     // clear the session payment ID
     Session::forget('paypal_payment_id');
     if (empty(Input::get('PayerID')) || empty(Input::get('token'))) {
         return Redirect::route('original.route')->with('error', 'Payment failed');
     }
     $payment = Payment::get($payment_id, $this->_api_context);
     // PaymentExecution object includes information necessary
     // to execute a PayPal account payment.
     // The payer_id is added to the request query parameters
     // when the user is redirected from paypal back to your site
     $execution = new PaymentExecution();
     $execution->setPayerId(Input::get('PayerID'));
     //Execute the payment
     $result = $payment->execute($execution, $this->_api_context);
     echo '<pre>';
     print_r($result);
     echo '</pre>';
     exit;
     // DEBUG RESULT, remove it later
     if ($result->getState() == 'approved') {
         // payment made
         return Redirect::route('original.route')->with('success', 'Payment success');
     }
     return Redirect::route('original.route')->with('error', 'Payment failed');
 }
Esempio n. 25
0
 function validate()
 {
     if (!Session::has('vatsimauth')) {
         throw new AuthException('Session does not exist');
     }
     $SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert'));
     $session = Session::get('vatsimauth');
     if (Input::get('oauth_token') !== $session['key']) {
         throw new AuthException('Returned token does not match');
         return;
     }
     if (!Input::has('oauth_verifier')) {
         throw new AuthException('No verification code provided');
     }
     $user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier'));
     if ($user) {
         Session::forget('vatsimauth');
         $authUser = User::find($user->user->id);
         if (is_null($authUser)) {
             $authUser = new User();
             $authUser->vatsim_id = $user->user->id;
             $authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last);
         }
         $authUser->last_login = Carbon::now();
         $authUser->save();
         Auth::login($authUser);
         Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!');
         return Redirect::intended('/');
     } else {
         $error = $SSO->error();
         throw new AuthException($error['message']);
     }
 }
Esempio n. 26
0
 /**
  * Account sign in form processing.
  *
  * @return Redirect
  */
 public function postSignin()
 {
     // Declare the rules for the form validation
     $rules = array('email' => 'required|email', 'password' => 'required|between:3,32');
     // Create a new validator instance from our validation rules
     $validator = Validator::make(Input::all(), $rules);
     // If validation fails, we'll exit the operation now.
     if ($validator->fails()) {
         // Ooops.. something went wrong
         return Redirect::back()->withInput()->withErrors($validator);
     }
     try {
         // Try to log the user in
         Sentry::authenticate(Input::only('email', 'password'), Input::get('remember-me', 0));
         // Get the page we were before
         $redirect = Session::get('loginRedirect', 'account');
         // Unset the page we were before from the session
         Session::forget('loginRedirect');
         // Redirect to the users page
         //return Redirect::to($redirect)->with('success', Lang::get('auth/message.signin.success'));
         return Redirect::to("/")->with('success', Lang::get('auth/message.signin.success'));
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         $this->messageBag->add('email', Lang::get('auth/message.account_not_found'));
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         $this->messageBag->add('email', Lang::get('auth/message.account_not_activated'));
     } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
         $this->messageBag->add('email', Lang::get('auth/message.account_suspended'));
     } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
         $this->messageBag->add('email', Lang::get('auth/message.account_banned'));
     }
     // Ooops.. something went wrong
     return Redirect::back()->withInput()->withErrors($this->messageBag);
 }
Esempio n. 27
0
 public function post_login()
 {
     $errors = new Laravel\Messages();
     $input = Input::get();
     try {
         $validator = new Services\Session\Login\Validator($input);
         $validator->publish();
     } catch (ValidateException $errors) {
         return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors->get());
     }
     try {
         $valid_login = Sentry::login(Input::get('email'), Input::get('password'), Input::get('remember-me'));
         if ($valid_login) {
             $url = null;
             if (Session::has('pre_login_url')) {
                 $url = Session::get('pre_login_url');
                 Session::forget('pre_login_url');
             } else {
                 $url = URL::to_route('dashboard.profile');
             }
             return Redirect::to($url);
         } else {
             $errors->add('errors', __('application.invalid_login'));
             return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors);
         }
     } catch (Sentry\SentryException $e) {
         $errors->add('errors', $e->getMessage());
         return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors);
     }
 }
 public function getPaymentStatus()
 {
     // Get the payment ID before session clear
     $payment_id = Session::get('paypal_payment_id');
     //echo '<pre>';print_r($payment_id);echo '</pre>';exit;
     // clear the session payment ID
     Session::forget('paypal_payment_id');
     //echo '<pre>';print_r(1);echo '</pre>';exit;
     if (!Input::get('PayerID') || !Input::get('token')) {
         return Redirect::to('padrinos/list_registrar_pagos')->with('error', 'El pago no se realizó correctamente');
     }
     //echo '<pre>';print_r($this->_api_context);echo '</pre>';exit;
     $payment = Payment::get($payment_id, $this->_api_context);
     // PaymentExecution object includes information necessary
     // to execute a PayPal account payment.
     // The payer_id is added to the request query parameters
     // when the user is redirected from paypal back to your site
     $execution = new PaymentExecution();
     $execution->setPayerId(Input::get('PayerID'));
     //Execute the payment
     $result = $payment->execute($execution, $this->_api_context);
     //echo '<pre>';print_r($result);echo '</pre>';exit; // DEBUG RESULT, remove it later
     if ($result->getState() == 'approved') {
         // payment made
         $idpago = Session::get('idcalendario_pago');
         //echo '<pre>';print_r($idpago);echo '</pre>';exit;
         $pago = CalendarioPago::find($idpago);
         $pago->fecha_pago = date("Y-m-d");
         $pago->banco = "PayPal";
         $pago->aprobacion = 1;
         $pago->save();
         return Redirect::to('padrinos/list_registrar_pagos')->with('message', 'El pago se realizó correctamente');
     }
     return Redirect::to('padrinos/list_registrar_pagos')->with('error', 'El pago no se realizó correctamente');
 }
Esempio n. 29
0
 public function __construct()
 {
     // Asset::add('jquery.dropdown.css', 'css/jquery.dropdown.css');
     Asset::add('bootstrap', 'css/bootstrap.min.css');
     Asset::add('bootstrap-responsive', 'css/bootstrap-responsive.css');
     Asset::add('common', 'css/common.css');
     // Asset::add('style', 'css/style.css');
     Asset::add('fontawsome', 'css/fontawesome.css');
     Asset::add('flickcss', 'css/flick/jquery-ui-1.10.2.custom.css');
     Asset::add('jquery', 'js/jquery-1.9.1.js');
     Asset::add('jquery-migrate-1.1.1.js', 'js/jquery-migrate-1.1.1.js');
     Asset::add('bootstrap-js', 'js/bootstrap.js');
     Asset::add('jqueryui', 'js/jquery-ui-1.10.2.custom.min.js');
     Asset::add('jquery.tablesorter.js', 'js/jquery.tablesorter.js');
     Asset::add('jquery.tablesorter.pager.js', 'js/jquery.tablesorter.pager.js');
     // $files = glob("public/css/pikachoose/*.css", GLOB_BRACE);
     // foreach($files as $file)
     // {
     // 	Asset::add($file, substr($file, 7));
     // }
     if (Session::has('id') && Auth::check()) {
         $account = Account::find(Session::get('id'));
         if ($account->admin == 1) {
             Session::put('admin', '1');
         } else {
             Session::put('admin', '0');
         }
         if ($account->blocked == 1) {
             Session::put('alert', "Your account has been banned. Please contact the admin for more details");
             Session::forget('id');
             Auth::logout();
         } else {
         }
     }
 }
Esempio n. 30
0
 public function logout()
 {
     Auth::logout();
     Session::forget('nombre');
     Session::forget('id');
     return Redirect::to('/');
 }