Merge branch 'dev'

# Conflicts:
#	Bootstrap.DataAccess/Dict.cs
This commit is contained in:
Argo Zhang 2019-04-29 16:27:38 +08:00
commit 911d55f229
23 changed files with 89 additions and 45 deletions

View File

@ -13,7 +13,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.4" />
<PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" PrivateAssets="All" />

Binary file not shown.

View File

@ -69,11 +69,12 @@ namespace Bootstrap.Admin.Controllers
/// <param name="loginUser"></param>
internal static void CreateLoginUser(IOnlineUsers onlineUserSvr, IIPLocatorProvider ipLocator, HttpContext context, LoginUser loginUser)
{
var agent = new UserAgent(context.Request.Headers["User-Agent"]);
loginUser.UserAgent = context.Request.Headers["User-Agent"];
var agent = new UserAgent(loginUser.UserAgent);
loginUser.Ip = (context.Connection.RemoteIpAddress ?? IPAddress.IPv6Loopback).ToString();
loginUser.City = ipLocator.Locate(loginUser.Ip);
loginUser.Browser = $"{agent.Browser.Name} {agent.Browser.Version}";
loginUser.OS = $"{agent.OS.Name} {agent.OS.Version}";
loginUser.Browser = $"{agent.Browser?.Name} {agent.Browser?.Version}";
loginUser.OS = $"{agent.OS?.Name} {agent.OS?.Version}";
}
/// <summary>

View File

@ -35,10 +35,11 @@ namespace Bootstrap.Admin.Controllers.Api
[HttpPost]
public bool Post([FromServices]IOnlineUsers onlineUserSvr, [FromServices]IIPLocatorProvider ipLocator, [FromBody]Log value)
{
var agent = new UserAgent(Request.Headers["User-Agent"]);
value.UserAgent = Request.Headers["User-Agent"];
var agent = new UserAgent(value.UserAgent);
value.Ip = (HttpContext.Connection.RemoteIpAddress ?? IPAddress.IPv6Loopback).ToString();
value.Browser = $"{agent.Browser.Name} {agent.Browser.Version}";
value.OS = $"{agent.OS.Name} {agent.OS.Version}";
value.Browser = $"{agent.Browser?.Name} {agent.Browser?.Version}";
value.OS = $"{agent.OS?.Name} {agent.OS?.Version}";
value.City = ipLocator.Locate(value.Ip);
value.UserName = User.Identity.Name;
return LogHelper.Save(value);

View File

@ -45,15 +45,8 @@
<input id="imgUrl" type="hidden" value="@Model.ImageLibUrl" />
<form id="login" method="post" class="form-signin">
<h2 class="form-signin-heading">@Model.Title</h2>
<div class="login-wrap" data-toggle="LgbValidate" data-valid-button="button[type='submit']">
@if (Model.AuthFailed)
{
<div class="alert alert-danger">用户名或密码错误!</div>
}
else
{
<div class="alert alert-success">请输入用户名与密码</div>
}
<div class="login-wrap" data-auth="@Model.AuthFailed" data-toggle="LgbValidate" data-valid-button="button[type='submit']">
<div class="alert alert-danger" asp-condition="@Model.AuthFailed">用户名或密码错误!</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">

View File

@ -65,7 +65,7 @@
</div>
<div class="form-group col-12">
<label class="control-label" for="dictCode">字典代码</label>
<input type="text" class="form-control flex-sm-fill" id="dictCode" placeholder="不可为空,500字以内" maxlength="500" data-valid="true" />
<input type="text" class="form-control flex-sm-fill" id="dictCode" placeholder="不可为空,2000字以内" maxlength="2000" data-valid="true" />
</div>
<div class="form-group form-group-dropdown col-12">
<label class="control-label" for="dictDefine">字典类型</label>

View File

@ -31,12 +31,12 @@
.login-wrap {
padding: 0;
margin: 12px 0 0 370px;
margin: 36px 0 0 370px;
width: 280px;
}
.slidercaptcha {
top: -282px;
top: -254px;
left: -15px;
}
@ -45,7 +45,20 @@
height: 280px;
}
.form-signin .form-group {
margin-bottom: 0.75rem;
.login-wrap[data-auth="True"] {
margin: 12px 0 0 370px;
}
.login-wrap[data-auth="True"] .slidercaptcha {
top: -282px;
}
.login-wrap[data-auth="True"] .slidercaptcha, .slidercaptcha.forgot {
width: 310px;
height: 280px;
}
.login-wrap[data-auth="True"] .form-group {
margin-bottom: 0.75rem;
}
}

View File

@ -14,7 +14,7 @@
.login-wrap {
padding: 20px;
height: 330px;
height: 270px;
}
.login-wrap .rememberPwd {
@ -27,6 +27,10 @@
width: 13px;
}
.login-wrap[data-auth="True"] {
height: 330px;
}
.login-footer a:last-child {
float: right;
}

View File

@ -608,6 +608,10 @@ li[data-category="1"] .dd3-content .menuType {
color: #235e90;
}
.bootstrap-table td {
word-break: break-all;
}
pre {
padding: 5px;
margin: 5px;

View File

@ -1,5 +1,5 @@
(function ($) {
var formatCategoryName = function(menu) {
var formatCategoryName = function (menu) {
var ret = "";
if (menu.IsResource === 2) ret = "按钮";
else if (menu.IsResource === 1) ret = "资源";
@ -23,7 +23,12 @@
var cascadeSubMenu = function (menus) {
var html = "";
$.each(menus, function (index, menu) {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu));
if (menu.Menus.length === 0) {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu));
}
else {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{6}</span><span class="menuOrder">{5}</span></div><ol class="dd-list">{4}</ol></li>', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeSubMenu(menu.Menus), menu.Order, formatCategoryName(menu));
}
});
return html;
};
@ -51,6 +56,7 @@
id: 0, url: Menu.url, query: { type: "user" }, method: "post",
callback: function (result) {
var html = "";
debugger;
if ($.isArray(result)) html = cascadeMenu(result);
$this.find('ol:first').html(html);
$this.nestable();

View File

@ -14,7 +14,7 @@
<PackageReference Include="Bootstrap.Security.DataAccess" Version="2.1.0" />
<PackageReference Include="Longbow.Cache" Version="2.2.7" />
<PackageReference Include="Longbow.Data" Version="2.2.8" />
<PackageReference Include="Longbow.Web" Version="2.2.10" />
<PackageReference Include="Longbow.Web" Version="2.2.11" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.4" />
</ItemGroup>

View File

@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.4" />
<PackageReference Include="Bootstrap.Security.Mvc" Version="2.2.5" />
<PackageReference Include="Longbow.Logging" Version="2.2.6" />
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

View File

@ -15,7 +15,7 @@
<PackageReference Include="Longbow.Data" Version="2.2.8" />
<PackageReference Include="Longbow.Logging" Version="2.2.6" />
<PackageReference Include="Longbow.Security.Cryptography" Version="1.3.0" />
<PackageReference Include="Longbow.Web" Version="2.2.10" />
<PackageReference Include="Longbow.Web" Version="2.2.11" />
<PackageReference Include="Longbow.Cache" Version="2.2.7" />
<PackageReference Include="Longbow" Version="2.2.9" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.2.4" />

View File

@ -35,8 +35,7 @@ namespace Bootstrap.DataAccess
{
if (dict.Category.Length > 50) dict.Category = dict.Category.Substring(0, 50);
if (dict.Name.Length > 50) dict.Name = dict.Name.Substring(0, 50);
if (dict.Code.Length > 500) dict.Code = dict.Code.Substring(0, 500);
if (dict.Code.Length > 2000) dict.Code = dict.Code.Substring(0, 2000);
DbManager.Create().Save(dict);
return true;

View File

@ -30,7 +30,8 @@ namespace Bootstrap.DataAccess
City = v.Location,
Browser = v.Browser,
OS = v.OS,
UserName = v.UserName
UserName = v.UserName,
UserAgent = v.UserAgent
});
}
}

View File

@ -13,8 +13,8 @@ namespace Bootstrap.DataAccess
/// </summary>
public string CRUD { get; set; }
/// <summary>
/// 获得/设置 请求数据
/// <summary>
/// 获得/设置 请求数据
/// </summary>
public string RequestData { get; set; }

View File

@ -50,6 +50,11 @@ namespace Bootstrap.DataAccess
/// </summary>
public string Result { get; set; }
/// <summary>
///
/// </summary>
public string UserAgent { get; set; }
/// <summary>
///
/// </summary>

View File

@ -49,6 +49,11 @@ namespace Bootstrap.DataAccess
/// </summary>
public string RequestUrl { get; set; }
/// <summary>
///
/// </summary>
public string UserAgent { get; set; }
/// <summary>
/// 保存访问历史记录
/// </summary>

View File

@ -273,6 +273,7 @@ CREATE TABLE [dbo].[Logs](
[City] [nvarchar](50) NULL,
[RequestUrl] [nvarchar](500) NOT NULL,
[RequestData] [nvarchar](500) NULL,
[UserAgent] [varchar](2000) NULL,
CONSTRAINT [PK_Logs] PRIMARY KEY CLUSTERED
(
[ID] ASC
@ -342,7 +343,7 @@ CREATE TABLE [dbo].[Dicts](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Category] [nvarchar](50) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[Code] [nvarchar](500) NOT NULL,
[Code] [nvarchar](2000) NOT NULL,
[Define] [int] NOT NULL,
CONSTRAINT [PK_dbo.Dict] PRIMARY KEY CLUSTERED
(
@ -499,6 +500,7 @@ CREATE TABLE [dbo].[LoginLogs](
[Browser] [varchar](50) NULL,
[City] [nvarchar](50) NULL,
[Result] [nvarchar](50) NOT NULL,
[UserAgent] [varchar](2000) NULL,
CONSTRAINT [PK_LoginLogs] PRIMARY KEY CLUSTERED
(
[ID] ASC
@ -556,6 +558,7 @@ CREATE TABLE [dbo].[Traces](
[OS] [varchar](50) NULL,
[City] [nvarchar](50) NULL,
[RequestUrl] [nvarchar](500) NOT NULL,
[UserAgent] [varchar](2000) NULL,
CONSTRAINT [PK_Traces] PRIMARY KEY CLUSTERED
(
[ID] ASC

View File

@ -87,7 +87,8 @@ CREATE TABLE Logs(
OS VARCHAR (50) NULL,
City VARCHAR (50) NULL,
RequestUrl VARCHAR (500) NOT NULL,
RequestData VARCHAR (500) NULL
RequestData VARCHAR (500) NULL,
UserAgent VARCHAR (2000) NULL
);
CREATE TABLE `Groups`(
@ -113,7 +114,7 @@ CREATE TABLE Dicts(
ID INTEGER PRIMARY KEY Auto_increment,
Category VARCHAR (50) NOT NULL,
Name VARCHAR (50) NOT NULL,
Code VARCHAR (500) NOT NULL,
Code VARCHAR (2000) NOT NULL,
Define INT NOT NULL DEFAULT 1
);
@ -158,7 +159,8 @@ CREATE TABLE LoginLogs(
OS VARCHAR (50) NULL,
Browser VARCHAR (50) NULL,
City VARCHAR (50) NULL,
Result VARCHAR (50) NOT NULL
Result VARCHAR (50) NOT NULL,
UserAgent VARCHAR (2000) NULL
);
CREATE TABLE ResetUsers(
@ -177,5 +179,6 @@ CREATE TABLE Traces(
Browser VARCHAR (50),
OS VARCHAR (50),
City VARCHAR (50),
RequestUrl VARCHAR (500) NOT NULL
RequestUrl VARCHAR (500) NOT NULL,
UserAgent VARCHAR (2000) NULL
);

View File

@ -87,7 +87,8 @@ CREATE TABLE Logs(
OS VARCHAR (50) NULL,
City VARCHAR (50) NULL,
RequestUrl VARCHAR (500) NOT NULL,
RequestData VARCHAR (500) NULL
RequestData VARCHAR (500) NULL,
UserAgent VARCHAR (2000) NULL
);
CREATE TABLE Groups(
@ -113,7 +114,7 @@ CREATE TABLE Dicts(
ID SERIAL PRIMARY KEY,
Category VARCHAR (50) NOT NULL,
Name VARCHAR (50) NOT NULL,
Code VARCHAR (500) NOT NULL,
Code VARCHAR (2000) NOT NULL,
Define INT NOT NULL DEFAULT 1
);
@ -158,7 +159,8 @@ CREATE TABLE RejectUsers(
OS VARCHAR (50) NULL,
Browser VARCHAR (50) NULL,
City VARCHAR (50) NULL,
Result VARCHAR (50) NOT NULL
Result VARCHAR (50) NOT NULL,
UserAgent VARCHAR (2000) NULL
);
CREATE TABLE ResetUsers(
@ -177,5 +179,6 @@ CREATE TABLE Traces(
Browser VARCHAR (50),
OS VARCHAR (50),
City VARCHAR (50),
RequestUrl VARCHAR (500) NOT NULL
RequestUrl VARCHAR (500) NOT NULL,
UserAgent VARCHAR (2000) NULL
);

View File

@ -87,7 +87,8 @@ CREATE TABLE Logs(
OS VARCHAR (50) NULL,
City VARCHAR (50) NULL,
RequestUrl VARCHAR (500) NOT NULL,
RequestData VARCHAR (500) NULL
RequestData VARCHAR (500) NULL,
UserAgent VARCHAR (2000) NULL
);
CREATE TABLE Groups(
@ -113,7 +114,7 @@ CREATE TABLE Dicts(
ID INTEGER PRIMARY KEY,
Category VARCHAR (50) NOT NULL,
Name VARCHAR (50) NOT NULL,
Code VARCHAR (500) NOT NULL,
Code VARCHAR (2000) NOT NULL,
Define INT NOT NULL DEFAULT (1)
);
@ -158,7 +159,8 @@ CREATE TABLE LoginLogs(
OS VARCHAR (50) NULL,
Browser VARCHAR (50) NULL,
City VARCHAR (50) NULL,
Result VARCHAR (50) NOT NULL
Result VARCHAR (50) NOT NULL,
UserAgent VARCHAR (2000) NULL
);
CREATE TABLE ResetUsers(
@ -177,5 +179,6 @@ CREATE TABLE Traces(
Browser VARCHAR (50),
OS VARCHAR (50),
City VARCHAR (50),
RequestUrl VARCHAR (500) NOT NULL
RequestUrl VARCHAR (500) NOT NULL,
UserAgent VARCHAR (2000)
);

Binary file not shown.