refactor: Lock 页面Post地址更改

This commit is contained in:
Argo Zhang 2019-08-21 15:28:31 +08:00
parent 6288a1bfb5
commit bbcfc15098
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 12 additions and 2 deletions

View File

@ -21,13 +21,15 @@ namespace Bootstrap.Admin.Controllers
[AutoValidateAntiforgeryToken]
public class AccountController : Controller
{
/// <summary>
/// 系统锁屏界面
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<ActionResult> Lock()
{
if (!User.Identity.IsAuthenticated) return Login();
var user = UserHelper.RetrieveUserByUserName(User.Identity.Name);
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
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>

View File

@ -30,7 +30,7 @@
<img alt="lock avatar" src="@Url.Content(Model.Icon)" />
<h1>@Model.DisplayName</h1>
<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" />
<div class="form-group">
<div class="input-group">