Merge branch 'refs/heads/dev'

This commit is contained in:
Argo Window10 2019-12-06 23:48:07 +08:00
commit 9c5064c4c3
15 changed files with 51 additions and 40 deletions

View File

@ -10,7 +10,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Longbow.Logging" Version="3.0.3-beta1" />
<PackageReference Include="Longbow.Logging" Version="3.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.0.0" />
<PackageReference Include="Sentry.AspNetCore" Version="2.0.0-beta6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc4" />

View File

@ -97,7 +97,7 @@ namespace Bootstrap.Admin
}
app.UseStatusCodePagesWithReExecute("/Home/Error/{0}");
app.UseHttpsRedirection();
if (Configuration.GetValue("UseHttps", true)) app.UseHttpsRedirection();
app.UseResponseCompression();
app.UseStaticFiles();
app.UseAutoGenerateDatabase();

View File

@ -54,7 +54,7 @@
<div class="row">
<div class="form-group col-sm-6">
<label class="control-label" for="userName">登录名称</label>
<input type="text" class="form-control" id="userName" placeholder="不可为空16字以内" minlength="4" maxlength="16" userName="true" remote="api/Register" data-remote-msg="此用户已存在" data-valid="true" />
<input type="text" class="form-control" id="userName" placeholder="不可为空16字以内" minlength="3" maxlength="16" userName="true" remote="api/Register" data-remote-msg="此用户已存在" data-valid="true" />
</div>
<div class="form-group col-sm-6">
<label class="control-label" for="displayName">显示名称</label>

View File

@ -80,7 +80,7 @@
"HomePath": "/Admin/Profiles",
"Scope": [ "user_info", "projects" ],
"Roles": [ "Administrators" ],
"App": "0",
"App": "Demo",
"StarredUrl": "https://gitee.com/api/v5/user/starred/LongbowEnterprise/BootstrapAdmin"
},
"GitHubOptions": {
@ -91,7 +91,7 @@
"HomePath": "/Admin/Profiles",
"Scope": [ "user_info", "repo" ],
"Roles": [ "Administrators" ],
"App": "0",
"App": "Demo",
"StarredUrl": "https://api.github.com/user/starred/ArgoZhang/BootstrapAdmin"
},
"WeChatOptions": {
@ -102,14 +102,14 @@
"HomePath": "/Admin/Profiles",
"Scope": [ "snsapi_login" ],
"Roles": [ "Administrators" ],
"App": "0"
"App": "Demo"
},
"SMSOptions": {
"CompanyCode": "<CompanyCode>",
"MD5Key": "MD5Key",
"Roles": [ "Administrators" ],
"HomePath": "/Admin/Profiles",
"App": "0"
"App": "Demo"
},
"TencentSMSOptions": {
"AppId": "<TencentAppId>",

View File

@ -61,6 +61,7 @@
}
],
"AppId": "BA",
"UseHttps": true,
"SwaggerPathBase": "",
"AllowOrigins": "http://localhost,http://ba.sdgxgz.cn",
"HealthsCloudUrl": "https://client.sdgxgz.com/api/Interface/Healths",
@ -84,7 +85,7 @@
"HomePath": "/Home/Index",
"Scope": [ "user_info", "projects" ],
"Roles": [ "Default" ],
"App": "2"
"App": "Demo"
},
"GitHubOptions": {
"Enabled": true,
@ -94,7 +95,7 @@
"HomePath": "/Home/Index",
"Scope": [ "user_info", "repo" ],
"Roles": [ "Default" ],
"App": "2"
"App": "Demo"
},
"WeChatOptions": {
"Enabled": true,
@ -104,14 +105,14 @@
"HomePath": "/Admin/Profiles",
"Scope": [ "snsapi_login" ],
"Roles": [ "Default" ],
"App": "0"
"App": "Demo"
},
"SMSOptions": {
"CompanyCode": "<CompanyCode>",
"MD5Key": "MD5Key",
"Roles": [ "Default" ],
"HomePath": "/Home/Index",
"App": "2"
"App": "Demo"
},
"TencentSMSOptions": {
"AppId": "<TencentAppId>",

View File

@ -134,20 +134,7 @@
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}" data-resource="{6}"><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), menu.IsResource);
}
else {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}" data-resource="{7}"><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), menu.IsResource);
}
});
return html;
};
var cascadeSubMenu = function (menus) {
var html = "";
$.each(menus, function (index, menu) {
if (menu.Menus.length === 0) {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}" data-resource="{6}"><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), menu.IsResource);
}
else {
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}" data-resource="{7}"><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), menu.IsResource);
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}" data-resource="{7}"><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, cascadeMenu(menu.Menus), menu.Order, formatCategoryName(menu), menu.IsResource);
}
});
return html;

View File

@ -8,14 +8,14 @@
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.0.1" />
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2" />
<PackageReference Include="Longbow" Version="3.0.1" />
<PackageReference Include="Longbow.Cache" Version="3.0.3-beta1" />
<PackageReference Include="Longbow.Cache" Version="3.0.3" />
<PackageReference Include="Longbow.Data" Version="3.0.1" />
<PackageReference Include="Longbow.GiteeAuth" Version="3.0.1" />
<PackageReference Include="Longbow.GitHubAuth" Version="3.0.1" />
<PackageReference Include="Longbow.OAuth" Version="3.0.2" />
<PackageReference Include="Longbow.PetaPoco" Version="1.0.2" />
<PackageReference Include="Longbow.Security.Cryptography" Version="1.3.0" />
<PackageReference Include="Longbow.Tasks" Version="3.0.2-beta2" />
<PackageReference Include="Longbow.Tasks" Version="3.0.3" />
<PackageReference Include="Longbow.Web" Version="3.0.1" />
<PackageReference Include="Longbow.WeChatAuth" Version="3.0.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.0.0" />

View File

@ -98,7 +98,7 @@ namespace Bootstrap.DataAccess
/// <param name="roles"></param>
internal static void SaveUser(User newUser, IEnumerable<string> roles)
{
if (!string.IsNullOrEmpty(newUser.Id))
if (string.IsNullOrEmpty(newUser.Id))
{
var uid = UserHelper.Retrieves().FirstOrDefault(u => u.UserName == newUser.UserName)?.Id;
var user = DbContextManager.Create<User>();
@ -114,9 +114,9 @@ namespace Bootstrap.DataAccess
var roleIds = role.Retrieves().Where(r => roles.Any(rl => rl.Equals(r.RoleName, StringComparison.OrdinalIgnoreCase))).Select(r => r.Id);
if (roleIds.Any())
{
#pragma warning disable CS8620 // 由于引用类型的可为 null 性差异,实参不能用于形参。
#nullable disable
role.SaveByUserId(newUser.Id, roleIds);
#pragma warning restore CS8620 // 由于引用类型的可为 null 性差异,实参不能用于形参。
#nullable restore
CacheCleanUtility.ClearCache(userIds: new string[0], roleIds: new string[0], cacheKey: $"{UserHelper.RetrieveUsersByNameDataKey}-{newUser.UserName}");
}
}

View File

@ -8,7 +8,7 @@
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.0.1" />
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2" />
<PackageReference Include="Longbow" Version="3.0.1" />
<PackageReference Include="Longbow.Cache" Version="3.0.3-beta1" />
<PackageReference Include="Longbow.Cache" Version="3.0.3" />
<PackageReference Include="Longbow.Data" Version="3.0.1" />
<PackageReference Include="Longbow.Web" Version="3.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.7.0" />

View File

@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Longbow.Logging" Version="3.0.3-beta1" />
<PackageReference Include="Longbow.Logging" Version="3.0.3" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.0.0" />
</ItemGroup>

View File

@ -56,12 +56,16 @@ namespace Bootstrap.Client.Controllers.Api
var password = section.GetValue("Password", "");
var from = section.GetValue("From", "");
var to = section.GetValue("To", "");
var port = section.GetValue("Port", 25);
var enableSsl = section.GetValue("EnableSsl", false);
if (!string.IsNullOrEmpty(password))
{
using var mailSender = new SmtpClient(smtpHost)
{
Credentials = new NetworkCredential(from, password)
Credentials = new NetworkCredential(from, password),
Port = port,
EnableSsl = enableSsl
};
await mailSender.SendMailAsync(from, to, title, message);
}

View File

@ -48,6 +48,8 @@
},
"SmtpClient": {
"Host": "smtp.163.com",
"Port": 587,
"EnableSsl": true,
"Password": "",
"From": "honeywell_mes@163.com",
"To": "argo@163.com"

View File

@ -43,6 +43,8 @@
},
"SmtpClient": {
"Host": "smtp.163.com",
"Port": 587,
"EnableSsl": true,
"Password": "",
"From": "honeywell_mes@163.com",
"To": "argo@163.com"

View File

@ -50,6 +50,10 @@
cursor: not-allowed;
}
.form-select.is-disabled .form-select-append {
color: #c0c4cc;
}
.form-select-input {
color: #606266;
outline: none;

View File

@ -75,7 +75,7 @@
// 新控件 <div class="form-select">
this.$ctl = $(lgbSelect.Template).insertBefore(this.$element);
if ($input.attr('data-toggle') === 'lgbSelect') {
this.$input = $input.addClass("form-select-input").attr("aria-haspopup", "true").attr("aria-expanded", "false").attr("data-toggle", "dropdown");
this.$input = $input.addClass("form-select-input").attr("aria-haspopup", "true").attr("aria-expanded", "false").attr("data-toggle", "dropdown").attr("readonly", true);
}
else {
this.$input = $('<input type="text" readonly="readonly" class="form-control form-select-input" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"/>');
@ -114,11 +114,17 @@
// save attributes
var attrs = [];
["id", "data-default-val"].forEach(function (v, index) {
["id", "name", "class", "data-valid", "data-default-val"].forEach(function (v, index) {
var value = that.$element.attr(v);
if (value !== undefined) attrs.push({ name: v, value: value });
});
var disabled = this.$element.prop('disabled');
// set disabled property
if (disabled) {
this.disabled();
}
// replace element select -> input hidden
this.$element.remove();
this.$element = $('<input type="hidden" data-toggle="lgbSelect" />').val(that.val()).insertBefore(this.$input);
@ -139,12 +145,15 @@
this.$input.removeAttr('disabled');
};
_proto.reset = function (value) {
_proto.reset = function (value, init) {
var that = this;
// keep old value
var oldValue = this.$input.attr('value');
// default select value
if (init == undefined) init = true;
// warning: must use attr('value') method instead of val(). otherwise the others input html element will filled by first element value.
// see https://gitee.com/LongbowEnterprise/longbow-select/issues/IZ3BR?from=project-issue
this.$input.attr('value', '').removeClass('is-valid is-invalid');
@ -153,10 +162,12 @@
$.each(value, function (index) {
var $item = $('<a class="dropdown-item" href="#" data-val="' + this.value + '">' + this.text + '</a>');
that.$menus.append($item);
if (this.selected === true || this.value === oldValue || index === 0 || this.value === that.$element.attr('data-default-val')) {
that.$input.attr('value', this.text);
that.$element.val(this.value).attr('data-text', this.text);
$activeItem = $item;
if (init) {
if (this.selected === true || this.value === oldValue || index === 0 || this.value === that.$element.attr('data-default-val')) {
that.$input.attr('value', this.text);
that.$element.val(this.value).attr('data-text', this.text);
$activeItem = $item;
}
}
});
if ($activeItem !== null) $activeItem.addClass('active');