ichynul/iframe-tabs

后台登录一直302

Closed this issue · 3 comments

0x7c6 commented

这个插件貌似和验证码插件james.xue/login-captcha有冲突,
image
在这修改了路由,但是验证码路由过不去,所以一直302

扩展配置的force_login_in_top用于控制登录超时以后的页面跳转,为true则整体跳转,所有已打开的tab都不在了,反之则是触发超时的那个tab跳转登录,登录成功以后所有tab可以继续操作。
你贴的这段代码,如果force_login_in_toptrue,会给登录页面的控制器(默认为Encore\Admin\Controllers\AuthController)加一个middleware,而这个middleware会把浏览器整体跳转登录:

if (window != top) {
            top.location.reload();
            
            document.querySelector('body').innerHTML = 
            '<div style="background:#fff;z-index:999;padding-top:88px;position:fixed;top:0px;height:10000px;width:100%;text-align:center;font-size:18px;"><p>{$message}</p></div>';
            
            if(!!(window.attachEvent && !window.opera)){
                document.execCommand("stop");
            }
            else {
                window.stop();
            }
        }

建议你把本扩展的force_login_in_top设置为fase试一下,或者禁用本扩展试一下,以便确认是这个扩展导致的问题。

修改一下laravel-admin的配置admin.php也许可以解决:

//....
 'auth' => [

       // 'controller' => App\Admin\Controllers\AuthController::class, //laravel-admin默认的登录控制器

       'controller' =>  Encore\James\JamesController::class,  //login-captcha的登录控制器

        'guard' => 'admin',

        'guards' => [
            'admin' => [
                'driver'   => 'session',
                'provider' => 'admin',
            ],
        ],

        'providers' => [
            'admin' => [
                'driver' => 'eloquent',
                'model'  => Encore\Admin\Auth\Database\Administrator::class,
            ],
        ],

        // Add "remember me" to login form
        'remember' => true,

        // Redirect to the specified URI when user is not authorized.
        'redirect_to' => 'auth/login',

        // The URIs that should be excluded from authorization.
        'excepts' => [
            'auth/login',
            'auth/logout',
        ],
    ],

//....
0x7c6 commented

谢谢大佬