public function filter(Route $route, Request $request) { if ($this->auth->check()) { $config = $this->config->get('c::redirect-login'); $url = $config ? $this->url->to($config) : '/'; return $this->redirect->to($url); } }
/** * Returns whether the logged in user is allowed to edit a page. * * @return bool */ public function allowedToEdit(Page $page = null) { if ($page === null) { return true; } return Editor::isEnabled() && $this->auth->check('edit', $page); }
/** * @param $request * @param callable $next * @return mixed */ public function handle($request, \Closure $next) { if ($this->auth->check()) { $this->app->setLocale($this->auth->user()->getLocale()); } return $next($request); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle(Request $request, Closure $next) { $asset = $request->route()->getParameter('asset'); if ($asset && !$this->auth->check()) { $ip = ip2long($request->ip()); if (!AssetDownload::recentlyLogged($asset->getId(), $ip)->count() > 0) { AssetDownload::create(['asset_id' => $asset->getId(), 'ip' => $ip, 'time' => time()]); $asset->incrementDownloads(); } } return $next($request); }
/** * Returns whether the given item should be visible to the user. * * @param array $item * @return bool */ protected function maySeeItem(array $item) { if (!isset($item['logged_in'])) { return true; } return $item['logged_in'] && $this->auth->check(); }
public function login() { if ($this->auth->check() && $this->auth->user()->can(['Dashboard'])) { return $this->redirector->route("dashboard"); } if ($this->auth->check() && !$this->auth->user()->can(['Dashboard'])) { return $this->redirector->route("home"); } $url = $this->request->get("url"); return $this->theme->baseDashboard("Admin::login")->with("url", $url); }
public function logout() { if (phpCAS::isSessionAuthenticated()) { if ($this->auth->check()) { $this->auth->logout(); } Session::flush(); phpCAS::logout(); exit; } }
/** * This method is used to logout from CAS * * @param string $service a URL that will be transmitted to the CAS server to do a redirect after logout * * @return none */ public function logout($service = "") { if (phpCAS::isSessionAuthenticated()) { if ($this->auth->check()) { $this->auth->logout(); } $this->session->flush(); if ($service != "") { phpCAS::logoutWithRedirectService($service); } else { phpCAS::logout(); } exit; } }
/** * Set user by auth * * @return $this */ public function setUserByAuth() { if ($this->auth->check()) { return $this->setUser($this->auth->user()); } }
/** * @return mixed */ public function isLoggedIn() { return $this->auth->check(); }