I have a project that consists of an administration.
What I'm doing is login, I already created the table and entered a user with password in the Hash
mode of Laravel.
I have the system that apparently works, what happens is that when I try to log in I always get the wrong data error and I'm putting the correct data username
and password
into the table.
Can you help me figure out the problem?
Controller
namespace App\Http\Controllers\admin;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\User;
use DB;
use Auth;
use Redirect;
use Hash;
use Illuminate\Support\Facades\Input;
class LoginController extends Controller
{
public function showLogin ()
{
if (Auth::check()) {
return Redirect::to('/admin');
}
return view('admin/login');
}
public function postLogin()
{
$data = [
'username' => Input::get('username'),
'passwd' => Input::get('password')
];
if (Auth::attempt($data)) {
return Redirect::intended('admin');
}
return Redirect::back()->with('error_message', 'Dados Incorrectos')->withInput();
}
public function logOut()
{
Auth::logout();
return Redirect::to('admin/login')->with('error_message', 'Logged out correctly');
}
}