我使用了Auth构建的Laravels。需要改变一些路径和东西。一切都很好。但我注意到我随机退出了。 Laravel将mit返回登录页面。此外,有时当我尝试登录时,可能会发生三种不同的事情,我不知道原因:
这是我的登录视图:
<form class="form-horizontal" role="form" method="POST" action="{{ url('/backend/login') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">@lang('admin/login.mail')</label>
<div class="col-md-12">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">@lang('admin/login.password')</label>
<div class="col-md-12">
<input id="password" type="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-2 col-md-offset-5">
<button type="submit" class="btn btn-primary">
Login
</button>
</div>
</div>
</form>
可能是什么问题?
答案 0 :(得分:0)
看起来会话存在一些问题,你正在使用Laravel版本吗?
您需要检查以确保会话运行良好的事项:
在 App \ Http \ Kernel.php 上,这是默认的内核中间件订单(Laravel 5.3)
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
如果您可以提供更多信息,我可以尝试为您提供更多帮助,希望它可以帮助您:)