Laravel 5.4身份验证空$请求

时间:2017-11-07 11:40:31

标签: php laravel middleware

我使用的是此处的AdminLte2 Laravel Package。 Laravel AdminLTE2

如果用户成功通过认证或只是重新加载登录表单,此软件包使用登录表单上的Vue.js重定向用户。

我使用Homestead在我的VM上本地安装了我的项目。这里的登录功能100%

但是,在我的登台服务器(http://sugarcoated.co/demo/vcc-backoffice/public/login)上,我无法登录。我已经对代码进行了一些挖掘,得出了以下结果。

我有 RedirectIfAuthenticated.php

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;
use Log;

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        Log::debug($request);
        if (Auth::guard($guard)->check()) {
            return redirect('/home');
        }

        return $next($request);
    }
}

当我记录在我的 VM 上发出的$请求时,我会收到包含电子邮件和密码的正确的帖子变量。

[2017-11-07 11:25:17] local.DEBUG: array (
  'email' => 'christiansen.marcus@gmail.com',
  'password' => 'wer',
  'remember' => NULL,
) 

当我在暂存网站上记录结果时,我收到一个空请求。

[2017-11-07 11:26:38] production.DEBUG: array (
) 

我不确定这是不是因为网站可能不是https,但由于某种原因,帖子请求没有被发送到中间件。

在部署应用程序时有什么我可以错过的吗?

部署流程

我正在使用Beanstalk部署到登台服务器。一旦部署了所有文件,我就

  1. composer install(/ vendor)
  2. npm install(/ node_modules)
  3. 添加.env文件并更新数据库连接详细信息 3.1数据库连接详细信息正确,因为我已成功运行 php artisan migrate --seed
  4. 将环境更改为&#39; production&#39;
  5. 更新

    LoginForm.vue文件负责提交表单。 方法是:

    submit () {
          this.form.post('/public/login')
           .then(response => {
             var component = this;
             setTimeout(function(){
               component.redirect(response)
             }, 2500);
           })
           .catch(error => {
             console.log(this.trans('adminlte_lang_message.loginerror') + ':' + error)
           })
        },
    

    我想也许更改帖子URL可以解决问题(因为我必须实际访问公共文件夹),但是,这也不起作用。

    日志::调试($请求 - &GT; fullUrl()); =&GT; http://sugarcoated.co/demo/vcc-backoffice/public/login

    更新 当我在LoginForm.vue中的console.log(this.form)时,该对象在登台服务器上为空,但在我的本地计算机上是正常的。怎么会这样?

    &#39;分段&#39; enter image description here

    &#39;本地&#39; enter image description here

0 个答案:

没有答案
相关问题