0
您好我有一個超級堰身份驗證登錄我的應用程序的工作就好像6個月而是一個整天的用戶和登錄我得到laravel 5.2身份驗證不起作用
TokenMismatchException in VerifyCsrfToken.php line 67:
後,我無法登錄了
所以我儘量在VerifyCrsftoken添加異常URL這樣
protected $except = [
'/login'
];
,現在我得到了登錄後重定向循環回到登錄頁面又是我的猜測是權威性是返回false,是否正確的電子郵件/密碼或不是想喝呃堰,我不知道是什麼原因它可以幫助我嗎?
route.php
Route::group(['middleware' => 'web'], function() {
Route::auth();
Route::get('/', '[email protected]');
Route::get('/home', '[email protected]');
Route::get('admin', '[email protected]');
Route::get('admin/tour', '[email protected]');
});
admincontroller.php
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Booking;
use App\Booktour;
use App\Bookcustomer;
use App\Bookdiscount;
use App\Booktourpay;
use App\Customerorder;
use App\Tourdetail;
use App\Tourperiod;
use App\Tourlead;
use Session;
use View;
use Carbon\Carbon;
use Auth;
use Datetime;
use DB;
use Image;
use App\User;
class AdminController extends Controller {
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$count_customer = Bookcustomer::count();
$getuser = Auth::user()->name;
$booking_order = Booking::where('sales_name', '=',$getuser)
->orderby('created_at', 'DSEC')
->get();
$booktour_open = DB::table('tourlist')->where('status' ,'=', 'เปิดขาย')->count();
$tour = Booktour::where('status', 'เปิดขาย')
->orderby('depart_date', 'asc')
->get();
$unpaid = Booking::where('sales_name', '=', $getuser)
->where('status', 'รอเงินโอน')
->count();
$allbook_list = Booking::where('status', '=', "รอเงินโอน")->orderby('created_at', 'DSEC')->get();
$today_date = strtotime('now');
$payment_list = Booktourpay::Today()->get();
$user_list_payment = Booktourpay::where('create_by', '=', $getuser)->get();
return view('admin.home')
->with('booking_order', $booking_order)
->with('count_customer', $count_customer)
->with('booktour_open', $booktour_open)
->with('tour', $tour)
->with('unpaid', $unpaid)
->with('allbook_list', $allbook_list)
->with('payment_list', $payment_list)
->with('user_list_payment', $user_list_payment);
}
auth.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model/table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| Here you may set the options for resetting passwords including the view
| that is your password reset e-mail. You may also set the name of the
| table that maintains all of the reset tokens for your application.
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'email' => 'auth.emails.password',
'table' => 'password_resets',
'expire' => 60,
],
],
];
login.blade.php
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Login</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
{!! csrf_field() !!}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
@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 class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input type="password" class="form-control" name="password">
@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"> Remember Me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-sign-in"></i>Login
</button>
<a class="btn btn-link" href="{{ url('/password/reset') }}">Forgot Your Password?</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
即時嘗試提高到5.2,仍然無法正常工作:/
編輯之後或之前登錄或訪問登錄頁面我得到這個redirectpage是什麼原因造成的? http://postimg.org/image/pcvuyonah/
嘗試它,它不起作用,我登錄後得到重定向頁面,如 「重定向到http:// xxxxxxxxxx/public/login」。 它像auth會話重定向後得到重置 – Wolfcain