1
I have 3 profile registered in the SQL Server database, they are Master, Admin and User , when log in as you would for each user to be directed to your permission view. by default the route ta loading the home/index.
// POST: /Account/Login
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (!ModelState.IsValid)
{
return View(model);
}
// Isso não conta falhas de login em relação ao bloqueio de conta
// Para permitir que falhas de senha acionem o bloqueio da conta, altere para shouldLockout: true
var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
switch (result)
{
case SignInStatus.Success:
return RedirectToLocal(returnUrl);
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.RequiresVerification:
return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
case SignInStatus.Failure:
default:
ModelState.AddModelError("", "Tentativa de login inválida.");
return View(model);
}
}
how to implement if, tried and did not compile, with your information above. @Gilberto-b-terra-Jr
My Accountcontroller is like this.
– Marlon Andrade
@Marlonandrade I changed the code above with a very simple example, if you have any questions, let me know where you got it. Remember that it is most important you really understand the code, beware of cake recipes. ;:)
– Gilberto B. Terra Jr.
OK, I warn you. I’m almost done.. @Gilberto B. Terra Jr..
– Marlon Andrade