php - Laravel 登录在边缘和 Internet Explorer 中不起作用

标签 php internet-explorer laravel-5 authentication microsoft-edge

使用 Laravel 5 登录无法在 Edge 和 Internet Explorer 中使用,但在其他浏览器中可以正常工作。

我们怀疑这与未正确存储 session 有关,但老实说,我们不知道是什么原因导致了这个问题。

当我们使用正确的详细信息登录时,登录逻辑被触发并正确完成,但之后它只是重定向回登录页面,所以中间件很可能认为用户没有登录并将它们返回到登录页面,这就是我们认为与 session 有关的原因。

这是我们的登录脚本:

    $rules = array('email' => 'required|email|min:3|max:60',
                   'password' => 'required|min:6|max:20');

    $attributeNames = array(
       'email' => strtolower(Lang::get('auth.email')),
       'password' => strtolower(Lang::get('auth.password')),     
    );

    $validator = Validator::make(Input::all(), $rules);
    $validator->setAttributeNames($attributeNames);

    if ($validator->fails()){ return Redirect::back()->withErrors($validator); die(); } 

    //Make an login attempt
    $auth = Auth::attempt(array(
        'email' => Input::get('email'),
        'password' => Input::get('password'),
        'role' => 'admin'
    ), false);

    if(!$auth){ 

        $auth2 = Auth::attempt(array(
            'email' => Input::get('email'),
            'password' => Input::get('password'),
            'role' => 'user'
        ), false);

        if(!$auth2){ 

            return Redirect::back()->withErrors(Lang::get('auth.errorText'))->withInput(Input::all());
            die();
        }

    }

    //If user is not activated
    if(Auth::User()->activated != 'OK'){

        Auth::logout();
        return Redirect::back()->withErrors(Lang::get('auth.notActivated'));
        die();
    }

    if(Auth::User()->sms_verificatie == '1') {

        $user = Auth::User();
        $user->sms_ok = 0;
        $user->save();

        $sms_codes_verwijderen = UsersSMSLogin::where('id_cms_users','=',Auth::User()->id)->delete();

        return Redirect::route('sms-verificatie');
        die();

    }

    Session::forget('dashboard_werkgever');

    return Redirect::route('dashboard');

最佳答案

更改 cookie 名称以删除 _(下划线)对我有用。

app/config/session.php 中更改

'cookie' => 'laravel_session'

'cookie' => 'laravelsession'

关于php - Laravel 登录在边缘和 Internet Explorer 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33240144/

相关文章:

php - 如何优化这个 PHP 脚本/删除 HTML

php - 使用 PHP PDO 时,我应该清理/过滤用户输入和输出吗?

Laravel 使用assertJson 测试集合JSON 响应

php - Laravel 5.0 utf8 转换?

javascript - & 到 base64 + Javascript 中的 &

javascript - 获取 html 复选框列表选中值到隐藏字段

php - 从未存储在 mysql 中的 PHP 中获取 TOTAL 值的排名

css - Chrome 认为它是 IE,正在评估条件

jquery - IE图像显示问题

javascript - Array.prototype.join 在 IE 8 中不起作用