diff --git a/Bootstrap.Admin/Controllers/AccountController.cs b/Bootstrap.Admin/Controllers/AccountController.cs index b0bd08dd..5b67ce28 100644 --- a/Bootstrap.Admin/Controllers/AccountController.cs +++ b/Bootstrap.Admin/Controllers/AccountController.cs @@ -21,13 +21,15 @@ namespace Bootstrap.Admin.Controllers [AutoValidateAntiforgeryToken] public class AccountController : Controller { - /// /// 系统锁屏界面 /// /// + [HttpGet] public async Task 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 }); } + /// + /// 系统锁屏界面 + /// + /// + [HttpPost] + [IgnoreAntiforgeryToken] + public Task Lock([FromServices]IOnlineUsers onlineUserSvr, [FromServices]IIPLocatorProvider ipLocator, string userName, string password) => Login(onlineUserSvr, ipLocator, userName, password, string.Empty); + /// /// 系统登录方法 /// diff --git a/Bootstrap.Admin/Views/Account/Lock.cshtml b/Bootstrap.Admin/Views/Account/Lock.cshtml index d42ff613..bf14632a 100644 --- a/Bootstrap.Admin/Views/Account/Lock.cshtml +++ b/Bootstrap.Admin/Views/Account/Lock.cshtml @@ -30,7 +30,7 @@ lock avatar

@Model.DisplayName

系统已锁定 -
+