/**
  * Redirect the user to the authentication page.
  *
  * @return Response
  */
 public function redirectToProvider($provider)
 {
     // Não permitir redirecionamento ao login da rede social caso
     // já tenha sido feito o login
     if (Sentinel::guest() && Auth::guest()) {
         return Socialite::driver($provider)->redirect();
     } else {
         return redirect()->route("home.index");
     }
 }
 /**
  * @param $request
  * @param Closure $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Sentinel::guest()) {
         throw new AccessDeniedHttpException(trans('auth.errors.invalid_permission'));
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Sentinel::guest() && Auth::guest()) {
         return redirect()->route("auth.getlogin");
     }
     return $next($request);
 }
Exemplo n.º 4
2
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Sentinel::guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     return $next($request);
 }
Exemplo n.º 5
2
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (Sentinel::guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return view('auth/login', ['locale' => Config::get("app.locale")]);
         }
     }
     return $next($request);
 }
 protected function dashboard()
 {
     // Se Sentinel::guest() = true => usuário entrou com Auth (Autentic. Social)
     // Caso contrário => usuário entrou com Sentinel (Autentic. Local)
     if (Sentinel::guest()) {
         // USUÁRIO AUTENTICANDO COM REDE SOCIAL
         $user = ["name" => Auth::user()->name, "email" => Auth::user()->email];
     } else {
         // USUÁRIO AUTENTICANDO LOCALMENTE
         $user = ["name" => Sentinel::getUser()->first_name, "email" => Sentinel::getUser()->email];
     }
     return view("user.dashboard", ["user" => $user]);
 }
Exemplo n.º 7
0
 /**
  * BaseController constructor.
  *
  * @param Request $request
  */
 public function __construct(Request $request)
 {
     //Get current request
     $this->request = $request;
     //Set active theme
     Theme::setActive('administration');
     //Check user is logged in
     if (Sentinel::guest()) {
         if (!in_array($request->getPathInfo(), $this->routes)) {
             return Redirect::to('/admin/auth/login')->send();
         }
     } else {
         $this->user = Sentinel::getUser();
         if (self::isAdmin() == 1) {
             $this->globalViewData();
         } else {
             Redirect::to('/404')->send();
         }
     }
 }
Exemplo n.º 8
0
 /**
  * BaseController constructor.
  *
  * @param Request $request
  */
 public function __construct(Request $request)
 {
     //Get current request
     $this->request = $request;
     //Set active theme
     Theme::setActive('dressplace');
     //Check user is logged in
     if (Sentinel::guest()) {
         if (!in_array($request->getPathInfo(), $this->routes)) {
             //				return Redirect::to('/admin/auth/login')->send();
         }
     } else {
         $this->user = Sentinel::getUser();
         self::getActiveUser();
     }
     //Init system
     $this->systemInit();
     //Load navigation
     $this->getNavPages();
     $this->getCategories();
 }
Exemplo n.º 9
0
 /**
  * Determine if the current user is a guest.
  *
  * @return bool
  */
 public function guest()
 {
     return Sentinel::guest();
 }