在auth尝试成功时,中间件不会重定向到页面。使用laravel 5.2和Mongo DB

时间:2016-04-19 06:26:03

标签: mongodb laravel-5.2

这在我的路线中

<?php

namespace App\Http\Controllers\Auth;

use App\User;

use Validator;

use App\Http\Controllers\Controller;

use Illuminate\Foundation\Auth\ThrottlesLogins;

use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

use Illuminate\Support\Facades\Input;

use Illuminate\Support\Facades\Redirect;

use Illuminate\Support\Facades\Request;

use Illuminate\Support\Facades\Auth;

use View;

class AuthController extends Controller

{

 public function companyLogin()

    {

      $userdata = array(

            'email' => Input::get('email'),

            'password'  =>Input::get('password'));

       $isAuth = Auth::attempt($userdata);

        if($isAuth)
        {

           return redirect()->intended('dashboard'); 

        } else {        

           return view('login');

        } 
    }
}

这是我的控制器:

Logger.log("SelectRow :" & SelectRow);

1 个答案:

答案 0 :(得分:0)

可能是你的证件错了。

->i mean did you bcrypted the password and saved in the database.
->if you not bcrypted the password,then you must bcrypt the password and save in database.
->Auth::attemptbcrypt the password and then checks 

示例:

$userdata = array(

            'email' => 'yahoo@gmail.com',

            'password'  =>'yahoo';

       $isAuth = Auth::attempt($userdata);

Auth ::尝试加密yahoo密码并检入数据库并返回false,以便重定向到登录