Add submenus for settings and profile. Add logout button.
parent
3f3d5b718b
commit
d6eff92835
|
@ -15,49 +15,20 @@ namespace LANCommander.Areas.Identity.Pages.Account
|
||||||
{
|
{
|
||||||
public class LogoutModel : PageModel
|
public class LogoutModel : PageModel
|
||||||
{
|
{
|
||||||
private readonly SignInManager<User> _signInManager;
|
private readonly SignInManager<User> SignInManager;
|
||||||
private readonly ILogger<LogoutModel> _logger;
|
private readonly ILogger<LogoutModel> Logger;
|
||||||
|
|
||||||
public LogoutModel(SignInManager<User> signInManager, ILogger<LogoutModel> logger)
|
public LogoutModel(SignInManager<User> signInManager, ILogger<LogoutModel> logger)
|
||||||
{
|
{
|
||||||
_signInManager = signInManager;
|
SignInManager = signInManager;
|
||||||
_logger = logger;
|
Logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet(string returnUrl = null, bool force = false)
|
public async Task<IActionResult> OnGet()
|
||||||
{
|
{
|
||||||
if (force)
|
await SignInManager.SignOutAsync();
|
||||||
{
|
|
||||||
await _signInManager.SignOutAsync();
|
|
||||||
_logger.LogInformation("User logged out.");
|
|
||||||
|
|
||||||
if (returnUrl != null)
|
return LocalRedirect("/");
|
||||||
{
|
|
||||||
return LocalRedirect(returnUrl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return LocalRedirect("/Identity/Account/Login");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Page();
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@page "/Profile"
|
@page "/Profile"
|
||||||
|
@page "/Profile/General"
|
||||||
@using Microsoft.AspNetCore.Components.Authorization;
|
@using Microsoft.AspNetCore.Components.Authorization;
|
||||||
@layout ProfileLayout
|
@layout ProfileLayout
|
||||||
@inject UserManager<User> UserManager
|
@inject UserManager<User> UserManager
|
||||||
|
|
|
@ -12,9 +12,24 @@
|
||||||
<MenuItem RouterLink="/Redistributables">Redistributables</MenuItem>
|
<MenuItem RouterLink="/Redistributables">Redistributables</MenuItem>
|
||||||
<MenuItem RouterLink="/Servers">Servers</MenuItem>
|
<MenuItem RouterLink="/Servers">Servers</MenuItem>
|
||||||
<MenuItem RouterLink="/Files">Files</MenuItem>
|
<MenuItem RouterLink="/Files">Files</MenuItem>
|
||||||
<MenuItem RouterLink="/Settings">Settings</MenuItem>
|
<SubMenu Title="Settings">
|
||||||
|
<MenuItem RouterLink="/Settings/General">General</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/Users">Users</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/Authentication">Authentication</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/UserSaves">User Saves</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/Archives">Archives</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/Media">Media</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/IPXRelay">IPX Relay</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/Beacon">Beacon</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/Tools">Tools</MenuItem>
|
||||||
|
</SubMenu>
|
||||||
}
|
}
|
||||||
<MenuItem RouterLink="/Profile">Profile</MenuItem>
|
<SubMenu Title="Profile">
|
||||||
|
<MenuItem RouterLink="/Profile">General</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Profile/ChangePassword">Change Password</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Profile/Saves">Saves</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Identity/Account/Logout">Logout</MenuItem>
|
||||||
|
</SubMenu>
|
||||||
</MainMenu>
|
</MainMenu>
|
||||||
|
|
||||||
<Content Style="padding: 24px; min-height: 100vh;">
|
<Content Style="padding: 24px; min-height: 100vh;">
|
||||||
|
|
Loading…
Reference in New Issue