From bbcfc15098c27bc65a4798c9f31c1bdab5f86078 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 21 Aug 2019 15:28:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20Lock=20=E9=A1=B5=E9=9D=A2Post?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Controllers/AccountController.cs | 12 +++++++++++- Bootstrap.Admin/Views/Account/Lock.cshtml | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) 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

系统已锁定 -
+