Support the ongoing development of Laravel.io →
posted 10 years ago
Views
Last updated 2 years ago.
0
Solution

I'm not sure if this works but you can try :)

// Routes

Session::put("wrongLogin", "0");

Route::get("/", function()
{

	return View::make("login")->with("wrongLogin", Session::get("wrongLogin"));

});


Route::post("/", function()
{

	$username = Input::get("username");
	$password = Input::get("password");

	$login = array("username" => $username, "password" => $password);

	if(Auth::attempt($login))
	{

		// show user link (logout, edit profile etc)

	} else {

		Sessions::put("wrongLogin",  (Session::get("wrongLogin") + 1));

		return View::make("login")->with("wrongLogin", Session::get("wrongLogin"));

	}
});



// View

@if($wrongLogin == 3)

Login is blocked

@else

Login form

@endif
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

prgmsaha prgmsaha Joined 20 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.