Welcome Guest, Not a member yet? Register   Sign In
redirect()->to() problem on IE
#5

(12-11-2021, 02:40 AM)InsiteFX Wrote: I use a named route for my dashboard and it works fine with Chrome, I gave up on IE years ago.

I still have a few users wwho are using IE.

This is where I call the 'dashboard' controller after settting the session values
--------------------------------------------------------------------------------------------
// Stroing session values
                $this->setUserSession($user);
                $temp = session()->get();
               
                // Redirecting to dashboard after login
                return redirect()->to(base_url('dashboard'));
----------------------------------------------------------------
This is "dashboard" controller

namespace App\Controllers;

use App\Controllers\BaseController;

class Dashboard extends BaseController
{
   
    public function index()
    {
        return view("dashboard");
    }
}

----------------------------------------------------------------------
This is route

$routes->match(['get', 'post'], 'register', 'User::register', ['filter' => 'noauth']);
$routes->match(['get', 'post'], 'login', 'User::login', ['filter' => 'noauth']);
$routes->get('dashboard', 'Dashboard::index', ['filter' => 'auth']);
$routes->get('profile', 'User::profile', ['filter' => 'auth']);
$routes->get('logout', 'User::logout');

---------------------------------------------------------------------
This is 'auth' filter


namespace App\Filters;

use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;

class Auth implements FilterInterface
{
    public function before(RequestInterface $request, $arguments = null)
    {
        if (!session()->get('isLoggedIn')) {
            return redirect()->to(site_url('login'));
        }

    }

    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
    {
        // Do something here
    }
}
Reply


Messages In This Thread
redirect()->to() problem on IE - by anishvm - 12-10-2021, 04:16 AM
RE: redirect()->to() problem on IE - by kenjis - 12-10-2021, 10:46 PM
RE: redirect()->to() problem on IE - by anishvm - 12-12-2021, 09:03 PM
RE: redirect()->to() problem on IE - by InsiteFX - 12-11-2021, 02:40 AM
RE: redirect()->to() problem on IE - by anishvm - 12-12-2021, 09:08 PM
RE: redirect()->to() problem on IE - by InsiteFX - 12-13-2021, 02:05 AM
RE: redirect()->to() problem on IE - by anishvm - 12-13-2021, 02:29 AM
RE: redirect()->to() problem on IE - by InsiteFX - 12-14-2021, 02:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB