/**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     $this->auth->logout();
     return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/')->header('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate');
     //return redirect(\URL::previous());
     //return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/')->header('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate')->header('Pragma', 'no-cache')->header('Expires', 'Fri, 01 Jan 1990 00:00:00 GMT');
 }
Пример #2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->route('auth.signin');
         }
     } else {
         $user = $this->auth->user();
         if ($user->ban) {
             if ($request->ajax()) {
                 return response('Unauthorized.', 401);
             } else {
                 $this->auth->logout();
                 notify()->flash('Banned', 'error', ['text' => $user->ban_reason]);
                 return redirect()->route('auth.signin');
             }
         }
     }
     /*$ipInfo = getIpInfo($request->getClientIp());
       if($ipInfo){
           if(isset($ipInfo['timezone'])){
               if($ipInfo['timezone'] != $this->auth->user()->timezone){
                   $this->auth->user()->update([
                       'timezone' => $ipInfo['timezone']
                   ]);
               }
           }
       }*/
     return $next($request);
 }
Пример #3
0
 /**
  * Handle
  * @param User $user
  * @throws UserNotActivatedException
  */
 public function handle(User $user)
 {
     if ($user && !$user->isActivated()) {
         $this->guard->logout();
         throw new UserNotActivatedException();
     }
 }
Пример #4
0
 /**
  * Handle
  * @param User $user
  */
 public function handle(User $user)
 {
     if ($user && $user->isBanned()) {
         $this->guard->logout();
         throw new UserIsBannedException('You are banned from the system');
     }
 }
Пример #5
0
 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     Activity::log('Admin logt uit');
     flash()->message(trans('auth.loggedOut'));
     $this->auth->logout();
     return redirect('/nl/auth/login');
 }
Пример #6
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 403);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     if (!$request->user()->isAdmin() && $request->user()->cannot('dashboard_view')) {
         $this->auth->logout();
         return redirect()->guest('auth/login')->withErrors(trans('messages.permission_denied'));
     }
     $route_array = explode('.', $request->route()->getName());
     $permission_name = array_search($route_array[2], array_dot($this->permission_fields));
     if ($permission_name) {
         $route_array[2] = explode('.', $permission_name)[0];
     }
     // $route_name = implode('_', $route_array);
     $route_name = $route_array[1] . '_' . $route_array[2];
     if (!$request->user()->isAdmin() && $request->user()->cannot($route_name)) {
         //PATCH 为null
         if ($request->ajax()) {
             return response()->json(['status' => trans('messages.permission_denied'), 'type' => 'error', 'code' => 403]);
         } else {
             return view('errors.403');
         }
     }
     return $next($request);
 }
Пример #7
0
 public function handle($request, Closure $next)
 {
     $response = $next($request);
     if ($this->auth->check()) {
         $this->auth->logout();
     }
     return $response;
 }
Пример #8
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check() && $this->auth->user()->isBanned()) {
         $this->auth->logout();
         return ujs_redirect(route('users.disabled'));
     }
     return $next($request);
 }
Пример #9
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->user()->confirmed) {
         $this->auth->logout();
         return redirect()->guest('auth/login')->with('message', "Por favor confirma tu email");
     }
     return $next($request);
 }
Пример #10
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         $this->auth->logout();
         return redirect()->back();
     }
     return $next($request);
 }
Пример #11
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->check() or $this->auth->user()->is_admin != 1) {
         $this->auth->logout();
         Session::flash('msg', 'Acesso restrito a administradores');
         return redirect('/auth/login');
     }
     return $next($request);
 }
Пример #12
0
 /**
  * Log user out.
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function logout()
 {
     // Save user id to use later
     $userId = $this->auth->user()->id;
     // Log user out and fire event
     $this->auth->logout();
     event(new UserLoggedOut($userId));
     return redirect(\URL::previous());
 }
Пример #13
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         if ($this->auth->user()->confirmed !== 1) {
             $this->auth->logout();
             return redirect('auth/login')->withErrors(['Mensaje Vinil-Shirt', 'Login Fallido, debes validar tu Email']);
         }
     }
     return $next($request);
 }
Пример #14
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->user()->is_admin) {
         $errors = new MessageBag();
         $errors->add('adminarea', 'Restricted Area. Please use a admin login.');
         $this->auth->logout();
         return view('auth.login', compact('errors'));
     }
     return $next($request);
 }
Пример #15
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // TODO:    don't automatically log the user out some time after
     //          issue #29 is fixed or when disabled_at starts being used for
     //          something other than merged accounts.
     if ($this->auth->check() && $this->auth->user()->disabled_at !== null && !($request->getMethod() === 'POST' && $request->getRequestUri() == '/auth/logout')) {
         $this->auth->logout();
         //            return Response::view('home.account-disabled', ['username' => $this->auth->user()->username], 403);
     }
     return $next($request);
 }
Пример #16
0
 /**
  * Handle
  * @param User $user
  */
 public function handle(User $user)
 {
     if ($user && $user->isSuspended()) {
         $this->guard->logout();
         throw new UserIsSuspendedException('You are temporarily suspended. Try again later.');
     } elseif ($user && $user->getSuspendedTill()) {
         $user->unsetSuspended();
         $this->repository->persist($user);
         $this->repository->flush();
     }
 }
Пример #17
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->user()->rol != 'admin') {
         $this->auth->logout();
         if ($request->ajax()) {
             return response('No tiene permisos para hacer la accion', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest() || !$this->auth->user()->isAdmin()) {
         $this->auth->logout();
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->to('auth/login')->withErrors(trans('admin.forbidden'));
         }
     }
     return $next($request);
 }
Пример #19
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->user()->hasRole('admin') && !$this->auth->user()->hasRole('partner')) {
         $this->auth->logout();
     }
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('admin/login');
         }
     }
     return $next($request);
 }
 /**
  * Handle the event.
  *
  * @param  User $user
  * @param  $remember
  * @return void
  */
 public function handle(User $user)
 {
     if ($user->subscriptionExpired()) {
         $this->auth->logout();
         if ($user->subscription->type == 'trial') {
             return redirect()->guest('/auth/login')->withErrors('Perioada de testare de 14 zile a expirat. Pentru detalii despre abonare contactati echipa Issue Monitoring Telefon: 031.080.2370 Email: office@cmpp.ro');
         }
         return redirect()->guest('/auth/login')->withErrors('Abonamentul tau a expirat.');
     }
     if ($user->active == 0) {
         $this->auth->logout();
         return redirect()->guest('/auth/login')->withErrors('Contul tau nu este activat.');
     }
 }
Пример #21
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user = $this->auth->user();
     //判断是否是管理员
     if (!$user || !$user->is('admin')) {
         $this->auth->logout();
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('/backend');
         }
     }
     return $next($request);
 }
Пример #22
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     if (auth()->user()->type == 'user') {
         $this->auth->logout();
     }
     return $next($request);
 }
Пример #23
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->user()->isAdmin()) {
         $this->auth->logout();
         $message = 'Usuario no autorizado';
         if ($request->ajax()) {
             return response('Unauthorized.', 401)->json(['message' => $message]);
         } else {
             \Session::flash('message', $message);
             return redirect()->to('auth/login');
         }
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user = $this->auth->user();
     if ($this->auth->check() && $user->status == 3) {
         return redirect('/home');
     }
     if ($this->auth->check() && $user->status == 1) {
         return redirect('/mhs/beranda');
     }
     if ($this->auth->check() && $user->status == 0) {
         $this->auth->logout();
         return redirect('auth/login')->withErrors(['notactive' => 'user tidak aktif']);
     }
     return $next($request);
 }
Пример #25
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (Auth::guard($guard)->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('login')->with('error', 'You must be logged in to perform this action.');
         }
     }
     if ($this->auth->check() && $this->auth->user()->active != 1) {
         $this->auth->logout();
         return redirect('/login')->with('error', 'Your account has yet to be activated.');
     }
     return $next($request);
 }
 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     // Checking event_id key exist in session.
     if (Session::has('event_id')) {
         $eventId = Session::get('event_id');
         $systemtrackId = Session::get('systemtrack_event_id');
         $systemtrack = Systemtrack::find($systemtrackId);
         $systemtrack->leave_at = date("Y-m-d H:i:s");
         $systemtrack->save();
         Session::forget('event_id');
         //  Session::forget('systemtrack_id');
     }
     if (Session::has('booth_id')) {
         $boothId = Session::get('booth_id');
         $systemtrackId = Session::get('systemtrack_booth_id');
         $systemtrack = Systemtrack::find($systemtrackId);
         $systemtrack->leave_at = date("Y-m-d H:i:s");
         $systemtrack->save();
         Session::forget('booth_id');
         // Session::forget('systemtrack_id');
     }
     $userId = Auth::user()->id;
     $now = new DateTime();
     // Tracklogin::where('user_id', $userId)
     //   ->max('login_at')
     //   ->update(['logout_at' => $now]);
     $maxLogin = DB::table('tracklogins')->where('user_id', $userId)->max('login_at');
     DB::table('tracklogins')->where('user_id', $userId)->where('login_at', $maxLogin)->update(['logout_at' => $now]);
     $this->auth->logout();
     return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     #logout if user not active
     if ($this->auth->check() and $this->auth->user()->active == 0) {
         $this->auth->logout();
         return redirect()->guest('/auth/login')->withErrors('Sorry, this user account is not active');
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     if ($this->auth->user()->is_admin != 1) {
         $this->auth->logout();
         $request->session()->flash('alert_admin', 'Somente usuários administradores podem acessar a área admim.');
         return redirect()->guest('auth/login');
     }
     return $next($request);
 }
	/**
	 * Log the user out of the application.
	 *
	 * @return \Illuminate\Http\Response
	 */
	public function getLogout()
	{
		$this->auth->logout();

		//return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
        return view('admin.login');
	}
Пример #30
0
 /**
  * Logout user from the application
  *
  * @return bool
  */
 public function logout()
 {
     $this->events->fire('account.logout.before');
     $this->auth->logout();
     $this->session->flush();
     $this->events->fire('account.logout.after');
     return true;
 }