Ejemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     //ck login
     if (Authen::check() == false) {
         return redirect('auth/login');
     }
     if (Authen::checkPermission() == false) {
         return view('errors.access_deny');
     }
     //        $userInfo = Authen::getUser();
     //        $role_id = $userInfo['role_id'];
     //        if($role_id == 1 || $role_id == 2){
     //
     //        } else {
     //
     //        var_dump(Session::get('user'));
     return $next($request);
 }
Ejemplo n.º 2
0
 public function doActive($nameUser, $keyActive)
 {
     //progress string
     $name = preg_replace('/[^a-zA-Z0-9\\-_]/', '', $nameUser);
     $key = preg_replace('/[^a-zA-Z0-9\\-_]/', '', $keyActive);
     $user = User::where('name', $name)->where('key_active', $key);
     //do active, update key
     $user->update(['status' => User::ACTIVED_STATUS, 'key_active' => str_random(30)]);
     if (Authen::check()) {
         Session::flush();
         if (Cache::has('user')) {
             Cache::forget('user');
         }
     }
     //end active
     return redirect('active_success');
 }