Skip to content

Commit

Permalink
Logout redirects to home page
Browse files Browse the repository at this point in the history
Fixed #14
  • Loading branch information
madskristensen committed Oct 28, 2017
1 parent 4c8cccd commit 5a84802
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Controllers/AccountController.cs
Expand Up @@ -2,7 +2,6 @@
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Miniblog.Core.Models;
Expand Down Expand Up @@ -56,10 +55,10 @@ public async Task<IActionResult> LoginAsync(string returnUrl, LoginViewModel mod
}

[Route("/logout")]
public async Task<IActionResult> LogOutAsync(string returnUrl = null)
public async Task<IActionResult> LogOutAsync()
{
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return LocalRedirect(returnUrl ?? "/");
return LocalRedirect("/");
}

[NonAction]
Expand Down
2 changes: 1 addition & 1 deletion src/Views/Shared/_Layout.cshtml
Expand Up @@ -52,7 +52,7 @@
if (User.Identity.IsAuthenticated)
{
<li><a asp-controller="Blog" asp-action="Edit">New post</a></li>
<li><a href="~/logout/?returnUrl=@path" title="Sign out as administrator">Sign out</a></li>
<li><a href="~/logout/" title="Sign out as administrator">Sign out</a></li>
}
else
{
Expand Down

0 comments on commit 5a84802

Please sign in to comment.