|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
ViewBag.UserName = "Admin";
|
||||
ViewBag.Password = "123789";
|
||||
}
|
||||
return User.Identity.IsAuthenticated ? (ActionResult)Redirect("~/Home/Index") : View("Login", new ModelBase());
|
||||
return User.Identity.IsAuthenticated ? (ActionResult)Redirect("~/Home/Index") : View("Login", new LoginModel());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -57,7 +57,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
var originUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].FirstOrDefault() ?? "~/Home/Index";
|
||||
return Redirect(originUrl);
|
||||
}
|
||||
return View("Login", new ModelBase());
|
||||
return View("Login", new LoginModel());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
using Bootstrap.DataAccess;
|
||||
|
||||
namespace Bootstrap.Admin.Models
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LoginModel : ModelBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public LoginModel()
|
||||
{
|
||||
ImageLibUrl = DictHelper.RetrieveImagesLibUrl();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证码图床地址
|
||||
/// </summary>
|
||||
public string ImageLibUrl { get; protected set; }
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@model ModelBase
|
||||
@model LoginModel
|
||||
@{
|
||||
ViewBag.Title = Model.Title;
|
||||
Layout = "_Layout";
|
||||
|
@ -42,6 +42,7 @@
|
|||
<script src="~/js/login.js" asp-append-version="true"></script>
|
||||
}
|
||||
<div class="container">
|
||||
<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']">
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
$(function () {
|
||||
var $imgUrl = $('#imgUrl');
|
||||
$(".container").autoCenter();
|
||||
|
||||
$("a[data-method]").on('click', function () {
|
||||
|
@ -94,8 +95,11 @@
|
|||
$('#captcha, #regcap, #forgotcap').sliderCaptcha({
|
||||
width: $.capWidth(),
|
||||
height: $.capHeight(),
|
||||
localImages: function () {
|
||||
return '../../lib/captcha/images/Pic' + Math.round(Math.random() * 4) + '.jpg';
|
||||
},
|
||||
setSrc: function () {
|
||||
return 'http://pocoafrro.bkt.clouddn.com/Pic' + Math.round(Math.random() * 136) + '.jpg';
|
||||
return $imgUrl.val() + 'Pic' + Math.round(Math.random() * 136) + '.jpg';
|
||||
},
|
||||
onSuccess: function () {
|
||||
var parent = this.$element.parents('.slidercaptcha').removeClass('d-block');
|
||||
|
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
@ -1,4 +1,4 @@
|
|||
(function ($) {
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
var SliderCaptcha = function (element, options) {
|
||||
|
@ -16,11 +16,15 @@
|
|||
PI: Math.PI,
|
||||
sliderL: 42, // 滑块边长
|
||||
sliderR: 9, // 滑块半径
|
||||
offset: 5, // 容错偏差
|
||||
loadingText: '正在加载中...',
|
||||
failedText: '再试一次',
|
||||
barText: '向右滑动填充拼图',
|
||||
repeatIcon: 'fa fa-repeat',
|
||||
maxLoadCount: 3
|
||||
maxLoadCount: 3,
|
||||
localImages: function () {
|
||||
return 'images/Pic' + Math.round(Math.random() * 4) + '.jpg';
|
||||
}
|
||||
};
|
||||
|
||||
function Plugin(option) {
|
||||
|
@ -40,9 +44,9 @@
|
|||
|
||||
var _proto = SliderCaptcha.prototype;
|
||||
_proto.init = function () {
|
||||
this.initDOM()
|
||||
this.initImg()
|
||||
this.bindEvents()
|
||||
this.initDOM();
|
||||
this.initImg();
|
||||
this.bindEvents();
|
||||
};
|
||||
|
||||
_proto.initDOM = function () {
|
||||
|
@ -86,7 +90,7 @@
|
|||
Object.assign(this, {
|
||||
canvas,
|
||||
block,
|
||||
sliderContainer : $(sliderContainer),
|
||||
sliderContainer: $(sliderContainer),
|
||||
refreshIcon,
|
||||
slider,
|
||||
sliderMask,
|
||||
|
@ -127,9 +131,6 @@
|
|||
var getRandomNumberByRange = function (start, end) {
|
||||
return Math.round(Math.random() * (end - start) + start);
|
||||
};
|
||||
var localImg = function () {
|
||||
return '../images/Pic' + Math.round(Math.random() * 4) + '.jpg';
|
||||
};
|
||||
var img = new Image();
|
||||
img.crossOrigin = "Anonymous";
|
||||
var loadCount = 0;
|
||||
|
@ -158,8 +159,8 @@
|
|||
that.text.text('加载失败').addClass('text-danger');
|
||||
return;
|
||||
}
|
||||
img.src = localImg();
|
||||
}
|
||||
img.src = that.options.localImages();
|
||||
};
|
||||
img.setSrc = function () {
|
||||
var src = '';
|
||||
loadCount = 0;
|
||||
|
@ -250,7 +251,7 @@
|
|||
setTimeout(() => {
|
||||
that.text.text(that.options.failedText);
|
||||
that.reset();
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -261,8 +262,8 @@
|
|||
document.addEventListener('mouseup', handleDragEnd);
|
||||
document.addEventListener('touchend', handleDragEnd);
|
||||
|
||||
document.addEventListener('mousedown', function() { return false; });
|
||||
document.addEventListener('touchstart', function() { return false; });
|
||||
document.addEventListener('mousedown', function () { return false; });
|
||||
document.addEventListener('touchstart', function () { return false; });
|
||||
};
|
||||
|
||||
_proto.verify = function () {
|
||||
|
@ -274,7 +275,7 @@
|
|||
var stddev = Math.sqrt(deviations.map(square).reduce(sum) / arr.length);
|
||||
var left = parseInt(this.block.style.left);
|
||||
return {
|
||||
spliced: Math.abs(left - this.x) < 4,
|
||||
spliced: Math.abs(left - this.x) < this.options.offset,
|
||||
verified: stddev !== 0, // 简单验证下拖动轨迹,为零时表示Y轴上下没有波动,可能非人为操作
|
||||
}
|
||||
};
|
||||
|
|
|
@ -82,5 +82,11 @@ namespace Bootstrap.Client.DataAccess
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string RetrieveIconFolderPath() => (RetrieveDicts().FirstOrDefault(d => d.Name == "头像路径" && d.Category == "头像地址" && d.Define == 0) ?? new BootstrapDict() { Code = "~/images/uploader/" }).Code;
|
||||
|
||||
/// <summary>
|
||||
/// 获取验证码图床
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string RetrieveImagesLibUrl() => (RetrieveDicts().FirstOrDefault(d => d.Name == "验证码图床" && d.Category == "系统设置" && d.Define == 0) ?? new BootstrapDict() { Code = "https://longbow-1258823021.cos.ap-shanghai.myqcloud.com/pic/280/150/" }).Code;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,17 @@ namespace Bootstrap.Client.Models
|
|||
public NavigatorBarModel(ControllerBase controller) : base(controller.User.Identity)
|
||||
{
|
||||
Navigations = MenuHelper.RetrieveAppMenus(UserName, $"~/{controller.ControllerContext.ActionDescriptor.ControllerName}/{controller.ControllerContext.ActionDescriptor.ActionName}");
|
||||
ImageLibUrl = DictHelper.RetrieveImagesLibUrl();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public IEnumerable<BootstrapMenu> Navigations { get; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ImageLibUrl { get; set; }
|
||||
}
|
||||
}
|
|
@ -15,6 +15,6 @@
|
|||
<p>
|
||||
<button id="btnCaptcha" class="btn btn-success"><i class="fa fa-send-o"></i><span>点击我出现行为验证码</span></button>
|
||||
<div class="card d-none" style="padding: 10px; height: 222px;">
|
||||
<div id="captcha"></div>
|
||||
<div id="captcha" data-imageLibUrl="@Model.ImageLibUrl"></div>
|
||||
</div>
|
||||
</p>
|
|
@ -1,14 +1,19 @@
|
|||
$(function () {
|
||||
$('#captcha').sliderCaptcha({
|
||||
var $captcha = $('#captcha');
|
||||
|
||||
$captcha.sliderCaptcha({
|
||||
localImages: function () {
|
||||
return '../../lib/captcha/images/Pic' + Math.round(Math.random() * 4) + '.jpg';
|
||||
},
|
||||
setSrc: function () {
|
||||
return 'http://pocoafrro.bkt.clouddn.com/Pic' + Math.round(Math.random() * 136) + '.jpg';
|
||||
return $captcha.attr('data-imageLibUrl') + 'Pic' + Math.round(Math.random() * 136) + '.jpg';
|
||||
},
|
||||
onSuccess: function () {
|
||||
var that = this;
|
||||
setTimeout(() => {
|
||||
that.parent().removeClass('d-inline-block');
|
||||
that.sliderCaptcha('reset');
|
||||
window.location.href = "/BA/Admin/Profiles";
|
||||
$('.userinfo .dropdown-menu a:first')[0].click();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
|
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 8.4 KiB |
|
@ -16,11 +16,15 @@
|
|||
PI: Math.PI,
|
||||
sliderL: 42, // 滑块边长
|
||||
sliderR: 9, // 滑块半径
|
||||
offset: 5, // 容错偏差
|
||||
loadingText: '正在加载中...',
|
||||
failedText: '再试一次',
|
||||
barText: '向右滑动填充拼图',
|
||||
repeatIcon: 'fa fa-repeat',
|
||||
maxLoadCount: 3
|
||||
maxLoadCount: 3,
|
||||
localImages: function () {
|
||||
return 'images/Pic' + Math.round(Math.random() * 4) + '.jpg';
|
||||
}
|
||||
};
|
||||
|
||||
function Plugin(option) {
|
||||
|
@ -40,9 +44,9 @@
|
|||
|
||||
var _proto = SliderCaptcha.prototype;
|
||||
_proto.init = function () {
|
||||
this.initDOM()
|
||||
this.initImg()
|
||||
this.bindEvents()
|
||||
this.initDOM();
|
||||
this.initImg();
|
||||
this.bindEvents();
|
||||
};
|
||||
|
||||
_proto.initDOM = function () {
|
||||
|
@ -86,7 +90,7 @@
|
|||
Object.assign(this, {
|
||||
canvas,
|
||||
block,
|
||||
sliderContainer : $(sliderContainer),
|
||||
sliderContainer: $(sliderContainer),
|
||||
refreshIcon,
|
||||
slider,
|
||||
sliderMask,
|
||||
|
@ -127,9 +131,6 @@
|
|||
var getRandomNumberByRange = function (start, end) {
|
||||
return Math.round(Math.random() * (end - start) + start);
|
||||
};
|
||||
var localImg = function () {
|
||||
return '../images/Pic' + Math.round(Math.random() * 4) + '.jpg';
|
||||
};
|
||||
var img = new Image();
|
||||
img.crossOrigin = "Anonymous";
|
||||
var loadCount = 0;
|
||||
|
@ -158,8 +159,8 @@
|
|||
that.text.text('加载失败').addClass('text-danger');
|
||||
return;
|
||||
}
|
||||
img.src = localImg();
|
||||
}
|
||||
img.src = that.options.localImages();
|
||||
};
|
||||
img.setSrc = function () {
|
||||
var src = '';
|
||||
loadCount = 0;
|
||||
|
@ -250,7 +251,7 @@
|
|||
setTimeout(() => {
|
||||
that.text.text(that.options.failedText);
|
||||
that.reset();
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -261,8 +262,8 @@
|
|||
document.addEventListener('mouseup', handleDragEnd);
|
||||
document.addEventListener('touchend', handleDragEnd);
|
||||
|
||||
document.addEventListener('mousedown', function() { return false; });
|
||||
document.addEventListener('touchstart', function() { return false; });
|
||||
document.addEventListener('mousedown', function () { return false; });
|
||||
document.addEventListener('touchstart', function () { return false; });
|
||||
};
|
||||
|
||||
_proto.verify = function () {
|
||||
|
@ -274,7 +275,7 @@
|
|||
var stddev = Math.sqrt(deviations.map(square).reduce(sum) / arr.length);
|
||||
var left = parseInt(this.block.style.left);
|
||||
return {
|
||||
spliced: Math.abs(left - this.x) < 4,
|
||||
spliced: Math.abs(left - this.x) < this.options.offset,
|
||||
verified: stddev !== 0, // 简单验证下拖动轨迹,为零时表示Y轴上下没有波动,可能非人为操作
|
||||
}
|
||||
};
|
||||
|
|
|
@ -176,5 +176,11 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool RetrieveSystemModel() => LgbConvert.ReadValue(DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "演示系统" && d.Define == 0)?.Code, "0") == "1";
|
||||
|
||||
/// <summary>
|
||||
/// 获得 验证码图床地址
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string RetrieveImagesLibUrl() => LgbConvert.ReadValue(DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "验证码图床" && d.Define == 0)?.Code, "https://longbow-1258823021.cos.ap-shanghai.myqcloud.com/pic/280/150/");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,5 +200,11 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool RetrieveSystemModel() => DbContextManager.Create<Dict>().RetrieveSystemModel();
|
||||
|
||||
/// <summary>
|
||||
/// 获得验证码图床地址
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string RetrieveImagesLibUrl() => DbContextManager.Create<Dict>().RetrieveImagesLibUrl();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设
|
|||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0)
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0)
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'演示系统', '0', 0)
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'验证码图床', 'https://longbow-1258823021.cos.ap-shanghai.myqcloud.com/pic/280/150/', 0)
|
||||
|
||||
DELETE FROM Navigations Where Category = N'0'
|
||||
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'后台管理', 10, N'fa fa-gear', N'~/Admin/Index', N'0')
|
||||
|
|
|
@ -341,5 +341,12 @@
|
|||
"Name": "演示系统",
|
||||
"Code": "0",
|
||||
"Define": NumberInt(0)
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("5bd6c73d5fa31256f77e4a49"),
|
||||
"Category": "系统设置",
|
||||
"Name": "验证码图床",
|
||||
"Code": "https://longbow-1258823021.cos.ap-shanghai.myqcloud.com/pic/280/150/",
|
||||
"Define": NumberInt(0)
|
||||
}
|
||||
]
|
|
@ -41,6 +41,7 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'IP地
|
|||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '演示系统', '0', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '验证码图床', 'https://longbow-1258823021.cos.ap-shanghai.myqcloud.com/pic/280/150/', 0);
|
||||
|
||||
DELETE FROM Navigations Where Category = '0';
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
|
||||
|
|
|
@ -40,6 +40,7 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'IP地
|
|||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '演示系统', '0', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '验证码图床', 'https://longbow-1258823021.cos.ap-shanghai.myqcloud.com/pic/280/150/', 0);
|
||||
|
||||
DELETE FROM Navigations Where Category = '0';
|
||||
INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
|
||||
|
|
|
@ -39,6 +39,7 @@ INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置
|
|||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0);
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0);
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', '演示系统', '0', 0);
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', '验证码图床', 'https://longbow-1258823021.cos.ap-shanghai.myqcloud.com/pic/280/150/', 0);
|
||||
|
||||
DELETE FROM Navigations Where Category = '0';
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
|
||||
|
|