I am trying to setup my local debugging environment for laravel application.
Everything was working fine. Today I deleted my vendor folder and did composer install. First I started getting error payload is undefined.
After that I am not able to login in the application as admin. This was not happening earlier. I am not sure why this is throwing error.
username: admin@admin.com password: admin12345
in DB in hashed format: $2y$10$BgzkwksC4dl8i3IWBGBGLudU1BjvK1giWf7wZeQm7dSOoxkaXfIAG
Hash::check($request->password, $admin->password) is always returning false.
Here is my Code:
public function login(Request $request){
$validation = Validator::make($request->all(), [
'email' => 'required|email',
'password' => 'required|min:5',
]);
if ($validation->fails()) {
return redirect()->back()->withErrors($validation)->withInput($request->only('email', 'remember'));
}
$admin = Admin::Where('email',$request->email)->first();
if($admin){
if (Hash::check($request->password, $admin->password)) {
Auth::guard('admin')->attempt(['email' => $request->email, 'password' => $request->password], $request->remember);
Session::put('admin', $admin);
return redirect()->intended(route('admin.home'));
}else{
return redirect()->back()->withErrors(['Wrong password.'])->withInput($request->only('email', 'remember'));
}
}
return redirect()->back()->withInput($request->only('email', 'remember'));
}
/composer.json/
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/socialite": "^3.0",
"laravel/tinker": "~1.0",
"maatwebsite/excel": "~2.1.0",
"mobiledetect/mobiledetectlib": "^2.8",
"nesbot/carbon": "^1.22",
"pear/http_request2": "^2.3",
"wildbit/laravel-postmark-provider": "^3.0",
"wildbit/postmark-php": "^2.5",
"vanderlee/swaggergen": "^2.3.19"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
via
Chebli Mohamed