mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-17 19:03:46 +00:00
7bb7ab6f13
Base functionality:
DB
email sending
user registration & login
storing new characters and reading them back
Notes:
Functionality is "hidden" with no links pointing to it.
Most pages are scaffolded and not reviewed at all :(
local Dev db setup is pushed to git
NO local email setup :(
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
#nullable disable
|
|
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Kemkas.Web.Db.Models;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Kemkas.Web.Areas.Identity.Pages.Account
|
|
{
|
|
public class LogoutModel : PageModel
|
|
{
|
|
private readonly SignInManager<ApplicationUser> _signInManager;
|
|
private readonly ILogger<LogoutModel> _logger;
|
|
|
|
public LogoutModel(SignInManager<ApplicationUser> signInManager, ILogger<LogoutModel> logger)
|
|
{
|
|
_signInManager = signInManager;
|
|
_logger = logger;
|
|
}
|
|
|
|
public async Task<IActionResult> OnPost(string returnUrl = null)
|
|
{
|
|
await _signInManager.SignOutAsync();
|
|
_logger.LogInformation("User logged out.");
|
|
if (returnUrl != null)
|
|
{
|
|
return LocalRedirect(returnUrl);
|
|
}
|
|
else
|
|
{
|
|
// This needs to be a redirect so that the browser performs a new
|
|
// request and the identity for the user gets updated.
|
|
return RedirectToPage();
|
|
}
|
|
}
|
|
}
|
|
}
|