public function before() { parent::before(); if (Auth::Check() === false) { Response::Redirect(Uri::Base()); } }
public function before() { parent::before(); if (\Settings::Get('signup_and_approve') === true && Auth::Check() === false) { Response::Redirect(Uri::Create('signup')); } }
/** * Responds to requests to GET /events */ public function getEvents() { $events = \Interested\Event::orderBy('updated_at', 'desc')->with('user')->get(); $eventsForCheckboxes = []; $user = new \Interested\User(); if (\Auth::Check()) { $eventsForCheckboxes = $user->getEventsForCheckboxes(); } return view('events.index')->with(['events' => $events, 'eventsForCheckboxes' => $eventsForCheckboxes]); }
public function getFM() { if (Auth::Check()) { if (Auth::User()->isAdmin()) { return View::make('filemaintenance.filemaintenance'); } else { return Redirect::Route('home'); } } else { return Redirect::Route('home'); } }
public function before() { // Lets render the template parent::before(); // Check to see if the config exsists if (file_exists(APPPATH . 'config/production/db.php') === false) { Response::Redirect('install'); } if (DBUtil::field_exists('urls', array('cached_preview')) === false && file_exists(APPPATH . 'classes/controller/upgrade.php')) { Response::Redirect(Uri::Create('upgrade')); } $real_base_url = Config::get('base_url'); Config::set('base_url', str_replace('public/', '', $real_base_url)); $base_url = Settings::get('different_short_url'); if (empty($base_url) === false) { View::set_global(array('base_url' => $base_url), false, false); } if (trim(Uri::Base(), '/') == Settings::get('different_short_url')) { if (count(Uri::Segments()) == 2) { $route = Uri::to_assoc(); if (isset($route) === true && $route['core'] == '404') { // We are good! } else { Response::Redirect(Settings::Get('base_url')); } } else { Response::Redirect(Settings::Get('base_url')); } } $data = null; if (Auth::Check()) { $user_id = Auth::get_user_id(); static::$user_id = $user_id[1]; $data['api_key'] = Auth::get('api_key'); if (empty($data['api_key']) === true) { if (empty($data['api_key']) === true) { $data['api_key'] = preg_replace('/\\+|\\/|\\=|\\?/', '', \Auth::instance()->hash_password(\Str::random()) . static::$user_id); // invalidate the hash \Auth::update_user(array('api_key' => $data['api_key']), Auth::get('username')); } } } // Lets set the default title , you can change it when calling the view $this->template->title = ucwords(str_replace('controller_', '', strtolower($this->request->route->controller))); try { Module::load('image'); $this->template->image_js = true; } catch (Exception $e) { } // Lets get the header and footer and set a variable to use within the template $this->template->footer = View::forge('core/footer', $data); $this->template->header = View::forge('core/header'); }
public function action_login($provider = null) { if (\Auth::Check()) { $user = Model_User::query()->related('user_providers')->where('id', static::$user_id)->get_one(); if (empty($user->user_providers) === false) { $provider_array = array(); foreach ($user->user_providers as $provider) { $provider_array[] = $provider->provider; } } if (in_array($provider, $provider_array)) { Response::Redirect(Uri::Base()); } } // bail out if we don't have an OAuth provider to call if ($provider === null) { \Response::redirect_back(); } // load Opauth, it will load the provider strategy and redirect to the provider \Auth_Opauth::forge(); }
public function confirmation($code, $id) { /*$genders = Gender::all(); $months = Month::all(); $user = User::find($id);*/ $account = User::find($id); if ($account['vCode'] == $code) { $account['isVerified'] = 1; if ($account->save()) { if (Auth::Check()) { return View::make('index')->with('mt', "HOME")->with('alert', 'success')->with('msg', 'You already confirmed your email'); //return Redirect::Route('home')->with('success','You already confirmed your email'); } else { return View::make('index')->with('mt', "HOME")->with('alert', 'success')->with('msg', 'You already confirmed your email. Please log in now.'); //return Redirect::Route('home')->with('success','You already confirmed your email. Please log in now.'); } } else { return View::make('index')->with('mt', "HOME")->with('alert', 'fail')->with('msg', 'Fail to verify your email. please try again.'); //return Redirect::Route('home')->with('fail','Fail to verify your email. please try again.'); } } }
Route::get('/register/confirm/{activation}', ['as' => 'Home', 'uses' => 'HomeController@getActivateUser']); Route::get('/', ['as' => 'Home', 'uses' => 'HomeController@getIndex']); Route::get('/home', ['as' => 'Home', 'uses' => 'HomeController@getIndex']); // Authentication routes... Route::get('auth/login', ['uses' => 'Auth\\AuthController@getLogin', 'as' => 'login']); Route::post('auth/login', 'AuthController@postIndex'); Route::get('auth/logout', 'Auth\\AuthController@getLogout'); // Registration routes... Route::get('auth/register', 'HomeController@getRegister'); Route::post('auth/register', 'HomeController@postRegister'); Route::get('/main', ['uses' => 'HomeController@getMain']); Route::get('/aboutUs', ['uses' => 'HomeController@getAboutUs']); Route::get('/contactUs', ['uses' => 'HomeController@getContactUs']); Route::get('/storage-and-preparation-equipment', ['uses' => 'HomeController@getStorageAndPreparationEquipment']); Route::get('/cooking-equipment', ['uses' => 'HomeController@getCookingEquipment']); Route::get('/foodService', ['uses' => 'HomeController@getFoodService']); Route::get('/product/{id}', ['uses' => 'HomeController@getItemDescription']); Route::post('/product/{id}', ['uses' => 'HomeController@postItemDescription']); Route::get('/mycart', ['uses' => 'HomeController@getMyCart']); Route::post('/mycart', ['uses' => 'HomeController@postMyCart']); $uses = Auth::Check() ? 'HomeController@postCheckoutFinal' : 'HomeController@postCheckout'; Route::post('/checkout', ['uses' => $uses]); Route::get('/checkout', ['uses' => $uses]); Route::post('/review', ['uses' => 'HomeController@postCheckoutFinal']); Route::get('/review', ['uses' => 'HomeController@getCheckoutFinal', 'middleware' => 'auth']); Route::get('/myaccount', ['uses' => 'HomeController@getMyAccount', 'middleware' => 'auth']); Route::post('/myaccount', ['uses' => 'HomeController@postMyAccount', 'middleware' => 'auth']); Route::get('/myorders', ['uses' => 'HomeController@getMyOrders', 'middleware' => 'auth']); Route::get('/order/{id}', ['middleware' => 'auth', 'uses' => 'HomeController@getOrder']); Route::post('/order/{id}', ['middleware' => 'auth', 'uses' => 'HomeController@postOrder']); Route::get('/searchproduct', ['uses' => 'HomeController@postSearchProduct']);
<?php /* |-------------------------------------------------------------------------- | Application & Route Filters |-------------------------------------------------------------------------- | | Below you will find the "before" and "after" events for the application | which may be used to do any work before or after a request into your | application. Here you may also register your custom route filters. | */ App::before(function ($request) { if (Auth::Check()) { $throttle = Sentry::findThrottlerByUserId(Auth::User()->id); if ($throttle->isSuspended() || $throttle->isBanned()) { Auth::logout(); return Redirect::to('/')->with('global_error', 'Depends on violation, your account has been suspended or banned.'); } } }); App::after(function ($request, $response) { // }); /* |-------------------------------------------------------------------------- | Authentication Filters |-------------------------------------------------------------------------- | | The following filters are used to verify that the user of the current | session is logged into this application. The "basic" filter easily
if (isset($_POST['submit'])) { if (!isset($_POST['g-recaptcha-response'])) { $msg = "Капча не установлена"; } else { require_once "recaptchalib.php"; $recaptcha = $_POST['g-recaptcha-response']; // ваш секретный ключ $secret = "6LflFhYTAAAAAF01b0XPvv4HlHfEbD_rSPcnN9Dx"; $reCaptcha = new ReCaptcha($secret); $response = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $recaptcha); if ($response->success) { $login = $_POST['login']; $password = $_POST['password']; $auth = new Auth(); # Если нет ошибок, то добавляем в БД нового пользователя $err = $auth->Check($login, $password); if (count($err) == 0) { $auth->Register($login, $password); //header("Location: login.php"); exit(); header("Location: /chat/check.php"); exit; } else { print "При регистрации произошли следующие ошибки:\n"; foreach ($err as $error) { print $error . "\n"; } } } } } include 'register.html';
public function postAddPaper() { if (\Auth::Check()) { $data = Input::all(); array_pop($data); $rules = ['subject' => 'required', 'year' => 'required', 'semester' => 'required']; $validator = Validator::make($data, $rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator->errors())->withInput(); } else { if (Input::hasFile('file')) { if (Input::file('file')->isValid()) { $destinationPath = 'papers'; // upload path $extension = Input::file('file')->getClientOriginalExtension(); // getting image extension if ($extension == 'pdf') { $fileName = $data['subject'] . '_' . $data['year'] . '_' . $data['semester'] . '.' . $extension; // renameing image Input::file('file')->move($destinationPath, $fileName); // uploading file to given path $paper = new Papers(); $paper->name = $fileName; $path->path = $destinationPath; $paper->save(); } } } Session::flash('err', "1"); return redirect('view_papers'); } } else { return redirect('login'); } }
$contents[] = $node; } } # done return $contents; } $app->post('/api/connect', function (Request $request) use($app, $db, $auth) { $login = $request->get('username'); $password = $request->get('password'); if ($auth->Login($login, $password)) { return $_COOKIE['session']; } return ''; }); $app->post('/api/disconnect', function (Request $request) use($app, $db, $auth) { if ($auth->Check($_COOKIE['session'])) { $date = new DateTime(); $hash = sha1(rand() * 992301230 . $date->getTimestamp()); setcookie('session', null, -1, '/'); $results = $db->query('UPDATE accounts SET hash="' . $hash . '" WHERE hash="' . $_COOKIE['session'] . '"'); session_destroy(); return '1'; } return ''; }); $app->post('/api/synchronize', function () use($app, $db) { if (IsValidSession($db)) { $uploaddir = '../uploads/' . $_SESSION['username'] . "/"; $uploadfile = $uploaddir . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) { } else {
public function getAddPapers() { $menu = Menu::Orderby('id', 'des')->get(); if (\Auth::Check()) { $user = User::where('username', Session::get('username'))->first(); if ($user->level == 0) { if (Session::get('err') == '1') { return view('add_paper', ['err' => "The Paper has been added."])->with('username', $user->username)->with('level', $user->level)->with('menu', $menu); } else { return view('add_paper')->with('username', $user->username)->with('level', $user->level)->with('err', "")->with('menu', $menu); } } else { return redirect('/'); } } else { return redirect('login'); } }
<?php include "auth.class.php"; /*ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1);*/ // Страница регситрации нового пользователя if (isset($_POST['submit'])) { $login = $_POST['login']; $password = $_POST['password']; $auth = new Auth($login, $password); # Если нет ошибок, то добавляем в БД нового пользователя $err = $auth->Check(); if (count($err) == 0) { $auth->Register(); //header("Location: login.php"); exit(); header("Location: check.php"); exit; } else { print "При регистрации произошли следующие ошибки:\n "; foreach ($err as $error) { print $error . "\n"; } } } ?> <span>Регистрация</span> <form method="POST"> Логин <input name="login" type="text">Пароль <input name="password" type="password"> <input name="submit" type="submit" value="Зарегистрироваться"> </form>
public function getViewPapers() { $menu = Menu::Orderby('id', 'des')->get(); $papers = Papers::Orderby('id', 'des')->get(); $id = 1; if (\Auth::Check()) { $user = User::where('username', Session::get('username'))->first(); return view('papers')->with('papers', $papers)->with('id', $id)->with('username', $user->username)->with('level', $user->level)->with('menu', $menu); } else { return redirect('login'); } }