-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added logout page and updated readme to dotnet 8
- Loading branch information
1 parent
8d9b6af
commit bf6d30e
Showing
5 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
examples/Passwordless.AspNetIdentity.Example/Pages/Account/Logout.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@page | ||
@model Passwordless.AspNetIdentity.Example.Pages.Account.Logout | ||
|
||
@{ | ||
ViewData["Title"] = "Logout"; | ||
} | ||
<h1>@ViewData["Title"]</h1> | ||
|
||
You have successfully logged out. |
26 changes: 26 additions & 0 deletions
26
examples/Passwordless.AspNetIdentity.Example/Pages/Account/Logout.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Identity; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Passwordless.AspNetIdentity.Example.Pages.Account; | ||
|
||
public class Logout : PageModel | ||
{ | ||
private readonly SignInManager<IdentityUser> _userSignInManager; | ||
private readonly ILogger<Logout> _logger; | ||
|
||
public Logout(SignInManager<IdentityUser> userSignInManager, ILogger<Logout> logger) | ||
{ | ||
_userSignInManager = userSignInManager; | ||
_logger = logger; | ||
} | ||
|
||
public async Task<IActionResult> OnGet() | ||
{ | ||
await _userSignInManager.SignOutAsync(); | ||
_logger.LogInformation("User has signed out."); | ||
return Page(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters