Ich zeige ein Formular an, wo, wenn der Benutzer nicht authentifiziert wird, gibt es eine Schaltfläche, die ein modales Login-Formular startet.Laravel Modal login erzeugt MethodNotAllowedHttpException aber authentifiziert
Ich gebe gültige Anmeldeinformationen ein und erlebe eine MethodNotAllowedHttpException. Ich bin jedoch authentifiziert. In einer anderen Registerkarte (oder durch Schlagen zurück und Nachladen)
(1/1) MethodNotAllowedHttpException
in RouteCollection.php (line 251)
at RouteCollection->methodNotAllowed(array('POST'))
in RouteCollection.php (line 238)
Meine modale Form:
<form class="form-horizontal" role="form" method="POST" action="{{ route('login') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<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">Password</label>
<div class="col-md-6">
<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-6 col-md-offset-4">
<div class="checkbox">
<label> <input type="checkbox"
name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me</label></div></div></div>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<button type="submit" class="btn btn-primary">Login</button>
<a href="#reset_modal" class="btn btn-link" data-toggle="modal" data-dismiss="modal" data-target="#reset_modal">
Forgot Your Password?</a></div></div></form>
Relevante Teil meiner SessionController.php:
public function store (Request $request) {
if (! auth()->attempt(request(['email', 'password']))) {
return back();
}
return redirect('/dashboard');
}
Relevante Route:
Route::post('/login', '[email protected]');
Ich kann nicht se em, um die Ursache auf die Ausnahme einzugrenzen. Hilfe wäre willkommen.
Warum melden Sie sich über den SessionController an, im Gegensatz zu Auth \ LoginController? Verwenden Sie ein anderes Paket für die Benutzerauthentifizierung? – btl
Ändern Sie Ihren Controller einmal –
Führen Sie 'php artisan route: list' aus, um zu sehen, was der Router für die Route/login aufgelistet hat. – btl