在进入管理页面之前登录需要F5 /刷新

时间:2017-08-07 09:27:10

标签: laravel

我想知道为什么我需要在登录后进入管理页面之前按F5。我希望我可以进入管理页面而不必先按下刷新F5。

home_admin.blade.php

<form class="navbar-form navbar-right" id="form_login" method="post" style="margin-top: 0;"
                  action="{{ url('/auth/login') }}">
                <input type="hidden" id="_token" name="_token" value="{{ csrf_token() }}">

                <div class="form-group">
                    <span class="control-header">Email</span>
                    <span><input type="text" name="email" placeholder="Email" required
                                 class="form-control"/></span>
                </div>
                <div class="form-group">
                    <span class="control-header">Password</span>
                    <span><input type="password" name="password" placeholder="Password" required
                                 class="form-control"/></span>
                    <input type="hidden" name="domain" required value="{{$domain}}"/>
                </div>
                <div class="form-group">
                    <h3 style="margin-top: 2px;">
                        <button type="submit" id="btn_login"><span class="glyphicon glyphicon-log-in"
                                                                   aria-hidden="true"></span> login
                        </button>
                    </h3>
                </div>
                <br>
                <a href="#" data-toggle="modal" data-target="#forgot_password"
                   style="margin-top: -7px;float: right;margin-right: 90px;font-size: 10px;color: white;">Forgot
                    Password?</a>
            </form>

routes.php文件

  Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController',
    'home'=>'HomeController',
    'member'=>'MemberController',
    'mail'=>'MailController',
    'social'=>'SocialController',
    'ajax'=>'AjaxController',
    'api'=>'ApiController',
    'timeline'=>'TimelineController',
    'setting'=>'SettingController',
     //    'ecommerce'=>'EcommerceController',
    'test'=>'TestController',
     ]);

AuthController.php

class AuthController extends Controller
{
 /*
 |--------------------------------------------------------------------------
 | Registration & Login Controller
 |--------------------------------------------------------------------------
 |
 | This controller handles the registration of new users, as well as the
 | authentication of existing users. By default, this controller uses
 | a simple trait to add these behaviors. Why don't you explore it?
 |
 */

  use AuthenticatesAndRegistersUsers, ThrottlesLogins;

  /**
  * Create a new authentication controller instance.
  *
  * @return void
  */
  public function __construct()
  {
  $this->middleware('guest', ['except' => 'getLogout']);
  }

  /**
  * Get a validator for an incoming registration request.
  *
  * @param  array  $data
  * @return \Illuminate\Contracts\Validation\Validator
  */
  protected function validator(array $data)
  {
     return Validator::make($data, [
      'name' => 'required|max:255',
      'email' => 'required|email|max:255|unique:users',
      'password' => 'required|confirmed|min:6',
     ]);
  }

  /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
  protected function create(array $data)
  {
   return User::create([
    'name' => $data['name'],
    'email' => $data['email'],
    'password' => bcrypt($data['password']),
     ]);
   }
 }

PasswordController.php

 class PasswordController extends Controller
 {
 /*
 |--------------------------------------------------------------------------
 | Password Reset Controller
 |--------------------------------------------------------------------------
 |
 | This controller is responsible for handling password reset requests
 | and uses a simple trait to include this behavior. You're free to
 | explore this trait and override any methods you wish to tweak.
 |
 */

 use ResetsPasswords;

 /**
  * Create a new password controller instance.
  *
  * @return void
  */
  public function __construct()
  {
     $this->middleware('guest');
  } 

  }

我也想知道它是否使用了javascript,因为我无法在文件的任何位置找到form_login(id =&#34; form_login&#34;)。

0 个答案:

没有答案