cari

Rumah  >  Soal Jawab  >  teks badan

Ubah hala - Laravel 5.2 Sesi hilang selepas perisian tengah diubah hala untuk mengesahkan tamat masa log masuk?

pemegang fungsi awam($permintaan, Penutupan $seterusnya, $penjaga = 'pengurus')

{
    if (!Auth::guard($guard)->check()) {
        return redirect('manager/login');
    }
    if (config('misc.session_timeout_status')) {
        $isLoggedIn = $request->path() != '/manager/logout';
        if (!session('lastActivityTime')) {
            $this->session->put('lastActivityTime', time());
        } elseif (time() - $this->session->get('lastActivityTime') > $this->timeout) {
            debugbar()->info('时间到!'.$this->timeout);
            log::info('时间到!'.$this->timeout);
            $this->session->forget('lastActivityTime');

            $cookie = cookie('intend', $isLoggedIn ? url()->current() : 'manager/');
            $email  = Auth::guard($guard)->user()->email;
            session()->flash('flash_danger', '您自动登出是出于安全原因,因为您' . $this->timeout / 60 . '分钟内没有活动。');
            Auth::guard($guard)->logout();

            return redirect()->to('/manager/login')->withErrors('您自动登出是出于安全原因,因为您' . $this->timeout / 60 . '分钟内没有活动。')->withInput(compact('email'))->withCookie($cookie);
        }
        $isLoggedIn ? $this->session->put('lastActivityTime', time()) : $this->session->forget('lastActivityTime');
    }

    return $next($request);
}

redirect后session或error都没值了,login接收不到数据,路由如下:

Laluan::kumpulan(['ruang nama' => 'Pengurus', 'awalan' => 'pengurus'], fungsi () {

Route::auth();

Route::group([
    'middleware' => ['admin'],
], function () {
    Route::get('/', 'HomeController@index');
    Route::resource('article', 'ArticleController');       
});

});

不知道哪里出问题了。
过去多啦不再A梦过去多啦不再A梦2750 hari yang lalu1177

membalas semua(1)saya akan balas

  • 天蓬老师

    天蓬老师2017-05-16 16:53:22

    Komponen tengah 'middleware' => ['admin'], disebabkan

    balas
    0
  • Batalbalas