refactor: Lock 页面Post地址更改
This commit is contained in:
parent
6288a1bfb5
commit
bbcfc15098
|
@ -21,13 +21,15 @@ namespace Bootstrap.Admin.Controllers
|
||||||
[AutoValidateAntiforgeryToken]
|
[AutoValidateAntiforgeryToken]
|
||||||
public class AccountController : Controller
|
public class AccountController : Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 系统锁屏界面
|
/// 系统锁屏界面
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
public async Task<ActionResult> Lock()
|
public async Task<ActionResult> Lock()
|
||||||
{
|
{
|
||||||
|
if (!User.Identity.IsAuthenticated) return Login();
|
||||||
|
|
||||||
var user = UserHelper.RetrieveUserByUserName(User.Identity.Name);
|
var user = UserHelper.RetrieveUserByUserName(User.Identity.Name);
|
||||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
var urlReferrer = Request.Headers["Referer"].FirstOrDefault();
|
var urlReferrer = Request.Headers["Referer"].FirstOrDefault();
|
||||||
|
@ -37,6 +39,14 @@ namespace Bootstrap.Admin.Controllers
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 系统锁屏界面
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[IgnoreAntiforgeryToken]
|
||||||
|
public Task<IActionResult> Lock([FromServices]IOnlineUsers onlineUserSvr, [FromServices]IIPLocatorProvider ipLocator, string userName, string password) => Login(onlineUserSvr, ipLocator, userName, password, string.Empty);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 系统登录方法
|
/// 系统登录方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<img alt="lock avatar" src="@Url.Content(Model.Icon)" />
|
<img alt="lock avatar" src="@Url.Content(Model.Icon)" />
|
||||||
<h1>@Model.DisplayName</h1>
|
<h1>@Model.DisplayName</h1>
|
||||||
<span class="locked">系统已锁定</span>
|
<span class="locked">系统已锁定</span>
|
||||||
<form role="form" class="form-inline justify-content-center" method="post" autocomplete="off" action="~/Account/Login?ReturnUrl=@Model.ReturnUrl">
|
<form role="form" class="form-inline justify-content-center" method="post" autocomplete="off" action="~/Account/Lock?ReturnUrl=@Model.ReturnUrl">
|
||||||
<input type="hidden" name="username" value="@Model.UserName" />
|
<input type="hidden" name="username" value="@Model.UserName" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|
Loading…
Reference in New Issue