Esempio n. 1
1
 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);
     }
 }
Esempio n. 2
0
 /**
  * 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);
 }
Esempio n. 3
0
 /**
  * @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);
 }
Esempio n. 5
0
 /**
  * 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();
 }
Esempio n. 6
0
 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);
 }
Esempio n. 7
0
 public function logout()
 {
     if (phpCAS::isSessionAuthenticated()) {
         if ($this->auth->check()) {
             $this->auth->logout();
         }
         Session::flush();
         phpCAS::logout();
         exit;
     }
 }
Esempio n. 8
0
 /**
  * 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;
     }
 }
Esempio n. 9
0
 /**
  * Set user by auth
  *
  * @return $this
  */
 public function setUserByAuth()
 {
     if ($this->auth->check()) {
         return $this->setUser($this->auth->user());
     }
 }
Esempio n. 10
0
 /**
  * @return mixed
  */
 public function isLoggedIn()
 {
     return $this->auth->check();
 }