Example #1
1
 private function login()
 {
     $session = new Session();
     if (!$session->has('documentsUser')) {
         $this->redirect('dokumenty-login.html', true);
     }
 }
Example #2
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']);
     }
 }
Example #3
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);
     }
 }
Example #4
0
 /**
  * @return mixed|static
  */
 public static function getInstance()
 {
     if (!\Session::has('cart')) {
         return new static();
     }
     return \Session::get('cart');
 }
Example #5
0
 public function get()
 {
     $user_id = false;
     if (Auth::check()) {
         // Authenticating A User And "Remembering" Them
         Session::regenerate();
         $user_id = Auth::user()->id;
         if (Auth::user()->accountType == 1) {
             if (Session::has('admin_session')) {
                 Log::info("admin_session already created before - " . Session::get('admin_session'));
             } else {
                 Session::put('admin_session', $user_id);
                 Log::info("admin_session created");
             }
         }
         //            Log::info("Session cre8 - " . Session::get('admin_session'));
     }
     //        else if (Auth::viaRemember()) {
     //            // Determining If User Authed Via Remember
     //            $user_id = Auth::user()->id;
     //        }
     if (!$user_id) {
         $error_response = array('error' => array('message' => 'User not logged in.', 'type' => 'OAuthException', 'code' => 400));
         Log::info("User not logged in");
         return Response::json($error_response, 400)->setCallback(Input::get('callback'));
     }
     $user = User::find(Auth::user()->id);
     return Response::json($user)->setCallback(Input::get('callback'));
 }
 public function testClearUserAddSelftProfile()
 {
     \Session::put('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile', 'test');
     assertThat(\Session::has('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile'), identicalTo(true));
     $this->add_profile_mgr->clearUserAddSelfProfile();
     assertThat(\Session::has('Giftertipster\\Service\\Add\\AddProfileMgr.user_add_self_profile'), identicalTo(false));
 }
Example #7
0
 public function islogin()
 {
     if (!\Session::has('user.uid')) {
         echo "<script>alert('您还没有登录,请先登录!');window.location.href='/login';</script>";
         exit;
     }
 }
 public function getModificar($id = null)
 {
     if (is_null($id) && !Session::has('solicitud')) {
         $data['nuevo'] = true;
     } else {
         $data['nuevo'] = false;
     }
     if (Session::has('solicitud') && is_null($id)) {
         $data['solicitud'] = new Solicitud(Session::get('solicitud'));
     } else {
         $data['solicitud'] = Solicitud::findOrFail($id);
     }
     if (!$data['solicitud']->puedeModificar()) {
         return Redirect::to('solicitudes')->with('error', 'Solo se pueden editar solicitudes en Elaboración');
     }
     $data['beneficiario'] = Persona::findOrFail($data['solicitud']->persona_beneficiario_id);
     $data['solicitante'] = Persona::findOrNew($data['solicitud']->persona_solicitante_id);
     $data['familiares'] = $data['beneficiario']->getFamiliares();
     $data['familiar'] = new Persona();
     $data['recaudo'] = new RecaudoSolicitud();
     $data['recaudos'] = $data['solicitud']->recaudosSolicitud;
     $data['presupuesto'] = new Presupuesto();
     $data['presupuestos'] = $data['solicitud']->presupuestos;
     $data['bitacora'] = new Bitacora();
     $data['bitacoras'] = $data['solicitud']->bitacoras;
     $data['parentesco'] = $data['beneficiario']->getParentesco($data['solicitante']->id);
     $data['foto'] = new FotoSolicitud();
     $data['fotos'] = $data['solicitud']->fotos;
     $data['beneficiario_kerux'] = new Oracle\Beneficiario();
     if (Request::ajax()) {
         return Response::json($data);
     }
     return View::make("solicitudes.plantilla", $data);
 }
 /**
  * @param Request $request
  * @Post("/gallery/upload")
  * @Patch("/gallery/upload")
  */
 public function upload(Request $request)
 {
     if (!Session::has('gallery_hash')) {
         Session::put('gallery_hash', md5(time()));
     }
     return Response::json(['attachment' => ImageUploadFacade::attachmentUpload($request->file('upl'), new GalleryAttachment(), 'gallery', true)]);
 }
Example #10
0
 function __construct()
 {
     parent::__construct();
     if (!Session::has('vendor_id')) {
         Redirect::to('/')->send();
     }
 }
Example #11
0
 public function __construct()
 {
     $this->oauth = new OAuth(self::CONFIG_KEY, self::CONFIG_SECRET);
     $this->state = Session::has('Twitter_State') ? Session::get('Twitter_State') : self::STATE_NOTHING;
     $this->token = Session::has('Twitter_Token') ? Session::get('Twitter_Token') : '';
     $this->tokenSecret = Session::has('Twitter_TokenSecret') ? Session::get('Twitter_TokenSecret') : '';
     if (Request::hasQuery('oauth_token')) {
         $this->state = self::STATE_AUTH;
         $this->token = Request::getQuery('oauth_token');
     }
     if (empty($this->token)) {
         $this->state = self::STATE_NOTHING;
     }
     // $this->destroy();
     switch ($this->state) {
         case self::STATE_NOTHING:
             break;
         case self::STATE_AUTH:
             $this->connect();
             break;
         case self::STATE_CONNECTED:
             $this->oauth->setToken($this->token, $this->tokenSecret);
             $this->credentials();
             break;
     }
 }
 public function getLogin()
 {
     if (\Session::has('adminlogin')) {
         return redirect()->action('\\Pianke\\Http\\Controllers\\AdminHomeController@getIndex');
     }
     return view("admin.login");
 }
Example #13
0
 public function publish()
 {
     $fb = new Facebook(['app_id' => Config::get('facebook.app_id'), 'app_secret' => Config::get('facebook.app_secret'), 'default_graph_version' => Config::get('facebook.default_graph_version'), 'persistent_data_handler' => Config::get('facebook.persistent_data_handler')]);
     $helper = $fb->getRedirectLoginHelper();
     if (Session::has('photo')) {
         if (Input::has('quePiensas')) {
             $data = ['message' => Input::get('quePiensas'), 'source' => $fb->fileToUpload(Session::get('photo'))];
             try {
                 // Returns a `Facebook\FacebookResponse` object
                 $response = $fb->post('/me/photos', $data, Session::get('fb_access_token'));
             } catch (Facebook\Exceptions\FacebookResponseException $e) {
                 echo 'Graph returned an error: ' . $e->getMessage();
                 exit;
             } catch (Facebook\Exceptions\FacebookSDKException $e) {
                 echo 'Facebook SDK returned an error: ' . $e->getMessage();
                 exit;
             }
             $graphNode = $response->getGraphNode();
             return Redirect::to('/')->with('mensaje', 'Publicado con exito!');
         } else {
             return Redirect::to('/')->with('mensaje', 'Sin mensaje no hay amor');
         }
     } else {
         return Redirect::to('/')->with('mensaje', 'Sin foto no hay amor');
     }
 }
 protected function is_verification_expired()
 {
     if (Session::has('verification') && Session::get('verification.expire') > time()) {
         return false;
     }
     return true;
 }
Example #15
0
 public function getLogin()
 {
     if (Session::has("logined")) {
         return Redirect::to('/');
     }
     return View::make('frontend.users.login');
 }
 public function getMessages($message_key)
 {
     if (Session::has($message_key)) {
         return Session::pull($message_key);
     }
     return array();
 }
Example #17
0
 /**
  * @return mixed
  */
 public function current()
 {
     if (!\Session::has('shopvel.language')) {
         \Session::put('shopvel.language', env('APP_LANG', 'en'));
     }
     return \Session::get('shopvel.language');
 }
Example #18
0
 public function getLogout()
 {
     if (Session::has('kukki_user')) {
         Session::forget('kukki_user');
         return Redirect::to('site/login');
     }
 }
 public function getEvent($id)
 {
     if (Session::has('in') && !strcmp(Session::get('in'), 'gautepJ9')) {
         return View::make('events.eventDisplay')->with('entries', Events::find($id));
     }
     return Redirect::to('admin/login')->with('isErr', true)->with('msg', 'You need to login first.');
 }
Example #20
0
 public function delete()
 {
     if (Session::has('current_user')) {
         Session::forget('current_user');
     }
     return Redirect::to('/');
 }
Example #21
0
 public function unsetUser()
 {
     if (\Session::has("User")) {
         \Session::forget("User");
         \Session::save();
     }
 }
Example #22
0
 public function index()
 {
     if (Session::has('user')) {
         Auth::login(Session::get('user'));
         if (Auth::user()->hak_akses == '1') {
             return Redirect::intended('hrdstaff');
         } elseif (Auth::user()->hak_akses == '2') {
             return Redirect::intended('hrdmanager');
         } elseif (Auth::user()->hak_akses == '3') {
             return Redirect::intended('direktur');
         } elseif (Auth::user()->hak_akses == '4') {
             return Redirect::intended('hrga');
         } elseif (Auth::user()->hak_akses == '5') {
             return Redirect::intended('keuangan');
         } elseif (Auth::user()->hak_akses == '6') {
             return Redirect::intended('karyawan');
         } elseif (Auth::user()->hak_akses == '7') {
             return Redirect::intended('pelamar');
         } else {
             return View::make('home');
         }
     } else {
         return View::make('home');
     }
 }
Example #23
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');
 }
 public function postSignupConfirm()
 {
     if (!Session::has('userGithubData')) {
         return $this->redirectAction('AuthController@getLogin');
     }
     return App::make('Lio\\Accounts\\UserCreator')->create($this, Session::get('userGithubData'));
 }
function LA_Session_Clear($key)
{
    // clear persisted value for the given string key
    if (\Session::has($key)) {
        \Session::remove($key);
    }
}
Example #26
0
function contactProcess()
{
    if (Session::has('contactus')) {
        $total = (int) Session::get('contactus');
        if ($total >= 5) {
            Redirect::to('404page');
            // Alert::make('Page not found');
        }
    }
    $valid = Validator::make(array('send.fullname' => 'min:2|slashes', 'send.email' => 'min:5|slashes', 'send.content' => 'min:3|slashes'));
    if (!$valid) {
        $alert = '<div class="alert alert-warning">Contact information not valid.</div>';
        return $alert;
    }
    if (!($id = Contactus::insert(Request::get('send')))) {
        $alert = '<div class="alert alert-warning">Error. ' . Database::$error . '</div>';
        return $alert;
    }
    if (Session::has('contactus')) {
        $total = (int) Session::get('contactus');
        $total++;
        Session::make('contactus', $total);
    } else {
        Session::make('contactus', '1');
    }
    $alert = '<div class="alert alert-success">Success. We will response soon!</div>';
    return $alert;
}
Example #27
0
 public static function get($var)
 {
     if (!Session::has($var)) {
         return false;
     }
     return Session::get($var);
 }
 public function __construct()
 {
     //si no exixte la variable de sesion cart, entonses la creamos y lo guardamos es un array vacio
     if (!\Session::has('cart')) {
         \Session::put('cart', array());
     }
 }
Example #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 {
         }
     }
 }
Example #30
0
 /**
  * Attempt to do login
  *
  */
 public function do_login()
 {
     $input = array('email' => Input::get('email'), 'username' => Input::get('email'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
     // If you wish to only allow login from confirmed users, call logAttempt
     // with the second parameter as true.
     // logAttempt will check if the 'email' perhaps is the username.
     // Get the value from the config file instead of changing the controller
     if (Confide::logAttempt($input, Config::get('confide::signup_confirm'))) {
         // Redirect the user to the URL they were trying to access before
         // caught by the authentication filter IE Redirect::guest('user/login').
         // Otherwise fallback to '/'
         // Fix pull #145
         if (Session::has('next_url')) {
             return Redirect::to(Session::get('next_url'));
         }
         return Redirect::intended('/');
         // change it to '/admin', '/dashboard' or something
     } else {
         $user = new User();
         // Check if there was too many login attempts
         if (Confide::isThrottled($input)) {
             $err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
         } elseif ($user->checkUserExists($input) and !$user->isConfirmed($input)) {
             $err_msg = Lang::get('confide::confide.alerts.not_confirmed');
         } else {
             $err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
         }
         return Redirect::action('UserController@login')->withInput(Input::except('password'))->with('error', $err_msg);
     }
 }