From e16385ddd23ed6bdb0c45b49ec44c4e1eb9a09be Mon Sep 17 00:00:00 2001 From: Argo Windows Date: Mon, 28 Oct 2019 22:59:32 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=90=8E=E5=8F=B0=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A6=96=E9=A1=B5=E5=A2=9E=E5=8A=A0=E5=8C=BF=E5=90=8D?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AdminController.cs | 42 +++++++++---------- .../Controllers/HomeController.cs | 8 ++-- .../Bootstrap.DataAccess.csproj | 2 +- .../Bootstrap.Client.DataAccess.csproj | 2 +- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/admin/Bootstrap.Admin/Controllers/AdminController.cs b/src/admin/Bootstrap.Admin/Controllers/AdminController.cs index b9654db8..2e690f9e 100644 --- a/src/admin/Bootstrap.Admin/Controllers/AdminController.cs +++ b/src/admin/Bootstrap.Admin/Controllers/AdminController.cs @@ -7,85 +7,85 @@ using System; namespace Bootstrap.Admin.Controllers { /// - /// + /// 后台管理控制器 /// [Authorize] public class AdminController : Controller { /// - /// + /// 后台管理首页 /// /// public ActionResult Index() => View(new NavigatorBarModel(this)); /// - /// + /// 用户维护 /// /// public ActionResult Users() => View(new NavigatorBarModel(this)); /// - /// + /// 部门维护 /// /// public ActionResult Groups() => View(new NavigatorBarModel(this)); /// - /// + /// 字典表维护 /// /// public ActionResult Dicts() => View(new NavigatorBarModel(this)); /// - /// + /// 角色维护 /// /// public ActionResult Roles() => View(new NavigatorBarModel(this)); /// - /// + /// 菜单维护 /// /// public ActionResult Menus() => View(new NavigatorBarModel(this)); /// - /// + /// 操作日志 /// /// public ActionResult Logs() => View(new NavigatorBarModel(this)); /// - /// + /// 脚本日志 /// /// public ActionResult SQL() => View(new NavigatorBarModel(this)); /// - /// + /// 访问日志 /// /// public ActionResult Traces() => View(new NavigatorBarModel(this)); /// - /// + /// 登录日志 /// /// public ActionResult Logins() => View(new NavigatorBarModel(this)); /// - /// + /// FA 图标页面 /// /// public ActionResult FAIcon() => View(new NavigatorBarModel(this)); /// - /// + /// 健康检查 /// /// public ActionResult Healths() => View(new NavigatorBarModel(this)); /// - /// + /// 图标视图 /// /// [AllowAnonymous] @@ -93,44 +93,44 @@ namespace Bootstrap.Admin.Controllers public PartialViewResult IconView() => PartialView("IconView"); /// - /// + /// 网站设置 /// /// public ActionResult Settings() => View(new SettingsModel(this)); /// - /// + /// 通知管理 /// /// public ActionResult Notifications() => View(new NavigatorBarModel(this)); /// - /// + /// 个人中心 /// /// /// public ActionResult Profiles([FromServices]IWebHostEnvironment host) => View(new ProfilesModel(this, host)); /// - /// + /// 程序异常 /// /// public ActionResult Exceptions() => View(new NavigatorBarModel(this)); /// - /// + /// 消息通知 /// /// public ActionResult Messages() => View(new NavigatorBarModel(this)); /// - /// + /// 任务管理 /// /// public ActionResult Tasks() => View(new TaskModel(this)); /// - /// + /// 客户端测试页面 /// /// public ActionResult Mobile() => View(new NavigatorBarModel(this)); diff --git a/src/admin/Bootstrap.Admin/Controllers/HomeController.cs b/src/admin/Bootstrap.Admin/Controllers/HomeController.cs index 719657b2..8b2796bc 100644 --- a/src/admin/Bootstrap.Admin/Controllers/HomeController.cs +++ b/src/admin/Bootstrap.Admin/Controllers/HomeController.cs @@ -9,7 +9,7 @@ namespace Bootstrap.Admin.Controllers /// /// Home Controller /// - [Authorize] + [AllowAnonymous] public class HomeController : Controller { /// @@ -18,7 +18,10 @@ namespace Bootstrap.Admin.Controllers /// public IActionResult Index() { - var model = new HeaderBarModel(User.Identity.Name); + var userName = User.Identity.Name; + if (string.IsNullOrEmpty(userName)) return Redirect(Request.PathBase + CookieAuthenticationDefaults.LoginPath); + + var model = new HeaderBarModel(userName); if (string.IsNullOrEmpty(model.UserName)) return Redirect(Request.PathBase + CookieAuthenticationDefaults.LogoutPath); var homeUrl = DictHelper.RetrieveHomeUrl(model.AppId); @@ -30,7 +33,6 @@ namespace Bootstrap.Admin.Controllers /// /// /// - [AllowAnonymous] public IActionResult Error(int id) { var model = ErrorModel.CreateById(id); diff --git a/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj b/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj index 7c36e9e2..491e3bd0 100644 --- a/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj +++ b/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj index ec7779b5..f0b91a96 100644 --- a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj +++ b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj @@ -5,7 +5,7 @@ - +