Добавил форму выхода (Logout)

parent 28aaeb02
......@@ -45,5 +45,15 @@ namespace webinar65.Controllers
return View(model);
}
public async Task<IActionResult> Logout()
{
if (_signInManager.IsSignedIn(User))
{
await _signInManager.SignOutAsync();
}
return RedirectToAction("Login");
}
}
}
......@@ -35,6 +35,10 @@
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
@if (User.Identity.IsAuthenticated)
{
<li><a asp-area="" asp-controller="Account" asp-action="Logout">Log out</a></li>
}
</ul>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment