From 208cb9bedecd7895d38d2790d15c374e9be5079a Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Thu, 10 Nov 2016 16:39:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B3=BB=E7=BB=9F=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/App_Start/DBPublisher.cs | 33 ++ Bootstrap.Admin/Bootstrap.Admin.csproj | 2 + Bootstrap.Admin/Controllers/HomeController.cs | 11 +- Bootstrap.Admin/Views/Shared/Header.cshtml | 385 +++++++++--------- Bootstrap.Admin/Web.config | 6 + .../Bootstrap.DataAccess.csproj | 1 + Bootstrap.DataAccess/ExceptionHelper.cs | 33 ++ .../Bootstrap.DataAccessTests.csproj | 1 + .../ExceptionHelperTests.cs | 20 + DatabaseScripts/InitData.sql | 4 +- DatabaseScripts/Install.sql | 34 +- 11 files changed, 330 insertions(+), 200 deletions(-) create mode 100644 Bootstrap.Admin/App_Start/DBPublisher.cs create mode 100644 Bootstrap.DataAccess/ExceptionHelper.cs create mode 100644 Bootstrap.DataAccessTests/ExceptionHelperTests.cs diff --git a/Bootstrap.Admin/App_Start/DBPublisher.cs b/Bootstrap.Admin/App_Start/DBPublisher.cs new file mode 100644 index 00000000..7ec5fde1 --- /dev/null +++ b/Bootstrap.Admin/App_Start/DBPublisher.cs @@ -0,0 +1,33 @@ +using Bootstrap.DataAccess; +using Longbow.Caching; +using Longbow.ExceptionManagement; +using Longbow.ExceptionManagement.Configuration; +using System; +using System.Collections.Specialized; +using System.Web; + +namespace Bootstrap.Admin +{ + /// + /// + /// + public class DBPublisher : IExceptionPublisher + { + /// + /// + /// + /// + /// + /// + public void Publish(Exception ex, NameValueCollection additionalInfo, ExceptionPublisherElement publisherElement) + { + if (publisherElement.Mode == PublisherMode.Off) return; + HttpContext context = HttpContext.Current; + additionalInfo["ErrorPage"] = context.Request.AppRelativeCurrentExecutionFilePath; + if (context.User != null) additionalInfo["UserId"] = context.User.Identity.Name; + additionalInfo["UserIp"] = context.Request.UserHostAddress; + ExceptionHelper.Log(ex, additionalInfo); + CacheManager.Clear(); + } + } +} \ No newline at end of file diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index 381ca403..4be1506f 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -43,6 +43,7 @@ 4 + @@ -205,6 +206,7 @@ bldver.cs + diff --git a/Bootstrap.Admin/Controllers/HomeController.cs b/Bootstrap.Admin/Controllers/HomeController.cs index d1ee31ea..5aff8b4c 100644 --- a/Bootstrap.Admin/Controllers/HomeController.cs +++ b/Bootstrap.Admin/Controllers/HomeController.cs @@ -49,6 +49,7 @@ namespace Bootstrap.Admin.Controllers { //UNDONE: 本方法有严重安全漏洞,发布前需要修正 var model = new LoginModel(); + if (string.IsNullOrEmpty(userName)) return View(model); model.UserName = userName; if (LgbPrincipal.IsAdmin(userName) || UserHelper.Authenticate(userName, password)) { @@ -72,15 +73,15 @@ namespace Bootstrap.Admin.Controllers /// /// [AllowAnonymous] - public ActionResult Register(string userName, string displayName, string password,string description) + public ActionResult Register(string userName, string displayName, string password, string description) { - var result = UserHelper.RegisterUser(userName, displayName, password,description); - if (result) + var result = UserHelper.RegisterUser(userName, displayName, password, description); + if (result) { return Redirect("/Content/html/RegResult.html"); } - - else + + else return View(); } } diff --git a/Bootstrap.Admin/Views/Shared/Header.cshtml b/Bootstrap.Admin/Views/Shared/Header.cshtml index f2edba15..c58710c4 100644 --- a/Bootstrap.Admin/Views/Shared/Header.cshtml +++ b/Bootstrap.Admin/Views/Shared/Header.cshtml @@ -21,201 +21,204 @@ } + @if (!Model.ShowMenu) + { - +
+
+ 87% Complete +
+
+ + +
  • + +
    +
    任务4
    +
    33%
    +
    +
    +
    + 33% Complete (danger) +
    +
    +
    +
  • +
  • + +
    +
    任务5
    +
    45%
    +
    +
    +
    + 45% Complete +
    +
    +
    +
  • +
  • + 查看所有任务 +
  • + + + + + + + + + + + }