Commit 6abef815 by guanzhenshan

增加登录验证

parent 7ef335b1
......@@ -631,7 +631,14 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
amount_prepaid = p.amount_prepaid.ToString("N2"),
cost_product = p.cost_product.ToString("N2"),
noshippingcount = p.noshippingcount.ToString("N0")
});
}).ToList();
var objEbay = list.Where(a => a.platform_type == "Ebay").FirstOrDefault();
if (objEbay != null)
{
list.Remove(objEbay);
list.Insert(3, objEbay);
}
return Json(list);
}
......
......@@ -11,10 +11,18 @@ namespace Bailun.DC.Web.Base
{
public class BaseController: Controller
{
public BaseController()
{
//private readonly IHttpContextAccessor _contextAccessor;
}
//public BaseController(IHttpContextAccessor contextAccessor)
//{
// _contextAccessor = contextAccessor;
// var cookie = HttpContext.Request.Cookies["BLUserAcct"];
// if (cookie == null)
// {
// HttpContext.Response.Redirect(ConfigHelper.GetByName("LoginUrl"), true);
// }
//}
#region Excel表格导出
......
......@@ -97,5 +97,36 @@ namespace Bailun.DC.Web.Controllers
return Json(result);
}
[HttpPost]
public JsonResult GetUserInfo(string acc)
{
var strResult = Common.HttpHelper.NetHelper.HttpPost(ConfigHelper.GetByName("GetUser"), "BLUserAcct=" + acc + "&webcode=wuliu");
try
{
var obj = Newtonsoft.Json.Linq.JObject.Parse(strResult);
if (obj["code"].ToString() != "0")
{
return Json(new
{
success = true,
userid = Convert.ToInt32(obj["data"]["UserId"].ToString().Trim()),
username = obj["data"]["UserName"].ToString().Trim(),
jobs = obj["data"]["Jobs"].ToString().Trim()
});
}
}
catch
{
}
return Json(new
{
success = false
});
}
}
}
\ No newline at end of file
......@@ -27,6 +27,10 @@
<link href="css/hplus/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
<link href="css/hplus/css/animate.min.css" rel="stylesheet">
<link href="css/hplus/css/style.min862f.css?v=4.1.0" rel="stylesheet">
<script src="css/hplus/js/jquery.min.js?v=2.1.4"></script>
<script src="~/js/jquery.cookie.js" type="text/javascript"></script>
<script src="~/js/common.js" type="text/javascript"></script>
</head>
<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
......@@ -330,7 +334,6 @@
<!--右侧部分结束-->
</div>
<script src="css/hplus/js/jquery.min.js?v=2.1.4"></script>
<script src="css/hplus/js/bootstrap.min.js?v=3.3.6"></script>
<script src="css/hplus/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="css/hplus/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
......@@ -338,5 +341,6 @@
<script src="css/hplus/js/hplus.min.js?v=4.1.0"></script>
<script type="text/javascript" src="css/hplus/js/contabs.min.js"></script>
<script src="css/hplus/js/plugins/pace/pace.min.js"></script>
</body>
</html>
......@@ -30,8 +30,11 @@ namespace Bailun.DC.Web
options.MinimumSameSitePolicy = SameSiteMode.None;
});
//עsession
services.AddSession();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......@@ -61,6 +64,9 @@ namespace Bailun.DC.Web
//app.UseMvcWithDefaultRoute();
// session
app.UseSession();
app.UseMvc(routes =>
{
routes.MapRoute(name: "areaRoute",
......
......@@ -8,6 +8,8 @@
"FeeUrl": "http://api.fee.bailuntec.com/purchase/other/cost/api/manageCostList",
"cn_str": "server=gz-cdb-kp7s5i79.sql.tencentcdb.com;port=61691;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;",
"cwUrl": "http://cw.bailuntec.com/api/api/GetRepayPlanDetails",
"rootFilePath": "C:\\WebSite\\DataCenter-NetCore2"
"rootFilePath": "C:\\WebSite\\DataCenter-NetCore2",
"LoginUrl": "http://www.bailuntec.com/Login/Index?guid=dbc0cffc7f4d11e8a4ca246e96754d42",
"LoginOutUrl": "http://www.bailuntec.com/Login/LoginOut",
"GetUser": "http://www.bailuntec.com/Login/GetUserByBLUserAcct"
}
var baseUrl = '';
var baseUrl = 'http://localhost:50181/';
var globalOrderSort='';
var globalOrderType='';
var globalOrderType = '';
var userid;
var username;
var jobs;
function OnlyTable(tableId, aoColumn, actionUrl, serverParams,tbParams,dataParam) {
var $btTable = $('#' + tableId);
$btTable.bootstrapTable({
......@@ -293,3 +296,29 @@ function numFormat(num) {
})
return res;
}
function login() {
var useracc = $.cookie('BLUserAcct');
//useracc = "4DF8961A9925E5F930133BB9235E605D4028EC3AA22DF07934EBDF7837FCBB9AC7D7B73BF50EF3B8B0B39499EFE2B0776303D6177B439F52B2781CD19831235EE5800ADB5B0770479A89E6DF7BA71D84|4DF8961A9925E5F925E15FBFCF682CAFA7CE698D19B44E255990FC4BF53934C8E87F5463597DB55AEE88A69634CB5A5FE25B58A53DE2651717042F901222BBD828E8ABA3401F54262493AA27D2E9383D0A097B881DF74984932FE6D929A706C0B0280272C4EDB089A66F2A11012E0C5CC19E7F0DF4490C8AF34AC401B4709A4AC9C10DF18923EF3DFE31F49C7E970031ED90B215F31D9CAE166DD59D87F5D1E60955AB383BE1F84F611D8B3C71247748D6F212472D44BB853F4935180429A01961CEFC8F7A528AE14BB1B4B987F4E337";
if (useracc == undefined || useracc == null) {
window.location = "http://www.bailuntec.com/Login/Index?guid=dbc0cffc7f4d11e8a4ca246e96754d42";
}
else {
$.submit({
type:'POST',
url: baseUrl+'Home/GetUserInfo?acc=' + useracc,
paramData: '',
func: function (result) {
if (result.success) {
userid = result.userid;
username = result.username;
jobs = result.jobs;
}
else {
window.location = "http://www.bailuntec.com/Login/Index?guid=dbc0cffc7f4d11e8a4ca246e96754d42";
}
}
})
}
}
login();
\ No newline at end of file
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (value !== undefined && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setTime(+t + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {};
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = parts.join('=');
if (key && key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) === undefined) {
return false;
}
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment