コード例 #1
1
ファイル: GuestFilter.php プロジェクト: anlutro/l4-core
 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);
     }
 }
コード例 #2
0
ファイル: Provider.php プロジェクト: imanghafoori1/boom-core
 /**
  * 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);
 }
コード例 #3
0
ファイル: Locale.php プロジェクト: studiocaro/HorseStories
 /**
  * @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);
 }
コード例 #4
0
 /**
  * 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);
 }
コード例 #5
0
ファイル: Builder.php プロジェクト: janusnic/laravel-tricks
 /**
  * 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();
 }
コード例 #6
0
ファイル: UserController.php プロジェクト: PhonemeCms/cms
 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);
 }
コード例 #7
0
ファイル: Sso.php プロジェクト: MateuszFlisikowski/cas
 public function logout()
 {
     if (phpCAS::isSessionAuthenticated()) {
         if ($this->auth->check()) {
             $this->auth->logout();
         }
         Session::flush();
         phpCAS::logout();
         exit;
     }
 }
コード例 #8
0
ファイル: Sso.php プロジェクト: rroslaniec/cas
 /**
  * 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;
     }
 }
コード例 #9
0
 /**
  * Set user by auth
  *
  * @return $this
  */
 public function setUserByAuth()
 {
     if ($this->auth->check()) {
         return $this->setUser($this->auth->user());
     }
 }
コード例 #10
0
ファイル: UserManager.php プロジェクト: coandacms/coanda-core
 /**
  * @return mixed
  */
 public function isLoggedIn()
 {
     return $this->auth->check();
 }