diff --git a/src/admin/Bootstrap.Admin/Bootstrap.Admin.csproj b/src/admin/Bootstrap.Admin/Bootstrap.Admin.csproj index 60085036..8af70d6c 100644 --- a/src/admin/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/src/admin/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/admin/Bootstrap.Admin/Startup.cs b/src/admin/Bootstrap.Admin/Startup.cs index 948e68cd..0de1418a 100644 --- a/src/admin/Bootstrap.Admin/Startup.cs +++ b/src/admin/Bootstrap.Admin/Startup.cs @@ -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(); diff --git a/src/admin/Bootstrap.Admin/Views/Admin/Users.cshtml b/src/admin/Bootstrap.Admin/Views/Admin/Users.cshtml index f2b37809..a53414ba 100644 --- a/src/admin/Bootstrap.Admin/Views/Admin/Users.cshtml +++ b/src/admin/Bootstrap.Admin/Views/Admin/Users.cshtml @@ -54,7 +54,7 @@
- +
diff --git a/src/admin/Bootstrap.Admin/appsettings.Development.json b/src/admin/Bootstrap.Admin/appsettings.Development.json index 4c6a1cc4..100af3f8 100644 --- a/src/admin/Bootstrap.Admin/appsettings.Development.json +++ b/src/admin/Bootstrap.Admin/appsettings.Development.json @@ -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": "", "MD5Key": "MD5Key", "Roles": [ "Administrators" ], "HomePath": "/Admin/Profiles", - "App": "0" + "App": "Demo" }, "TencentSMSOptions": { "AppId": "", diff --git a/src/admin/Bootstrap.Admin/appsettings.json b/src/admin/Bootstrap.Admin/appsettings.json index 7338804b..6240bd53 100644 --- a/src/admin/Bootstrap.Admin/appsettings.json +++ b/src/admin/Bootstrap.Admin/appsettings.json @@ -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": "", "MD5Key": "MD5Key", "Roles": [ "Default" ], "HomePath": "/Home/Index", - "App": "2" + "App": "Demo" }, "TencentSMSOptions": { "AppId": "", diff --git a/src/admin/Bootstrap.Admin/wwwroot/js/common-scripts.js b/src/admin/Bootstrap.Admin/wwwroot/js/common-scripts.js index c47f71f7..56c11cde 100644 --- a/src/admin/Bootstrap.Admin/wwwroot/js/common-scripts.js +++ b/src/admin/Bootstrap.Admin/wwwroot/js/common-scripts.js @@ -134,20 +134,7 @@ html += $.format('
  • {5}{4}
  • ', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu), menu.IsResource); } else { - html += $.format('
  • {6}{5}
      {4}
  • ', 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('
  • {5}{4}
  • ', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu), menu.IsResource); - } - else { - html += $.format('
  • {6}{5}
      {4}
  • ', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeSubMenu(menu.Menus), menu.Order, formatCategoryName(menu), menu.IsResource); + html += $.format('
  • {6}{5}
      {4}
  • ', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeMenu(menu.Menus), menu.Order, formatCategoryName(menu), menu.IsResource); } }); return html; diff --git a/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj b/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj index 3927909f..92fa058d 100644 --- a/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj +++ b/src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj @@ -8,14 +8,14 @@ - + - + diff --git a/src/admin/Bootstrap.DataAccess/Helper/OAuthHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/OAuthHelper.cs index cf36f8ae..c18e1411 100644 --- a/src/admin/Bootstrap.DataAccess/Helper/OAuthHelper.cs +++ b/src/admin/Bootstrap.DataAccess/Helper/OAuthHelper.cs @@ -98,7 +98,7 @@ namespace Bootstrap.DataAccess /// internal static void SaveUser(User newUser, IEnumerable 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(); @@ -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}"); } } diff --git a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj index 5748ecb3..56027ece 100644 --- a/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj +++ b/src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/client/Bootstrap.Client/Bootstrap.Client.csproj b/src/client/Bootstrap.Client/Bootstrap.Client.csproj index 4e5b0969..bd8ffbc9 100644 --- a/src/client/Bootstrap.Client/Bootstrap.Client.csproj +++ b/src/client/Bootstrap.Client/Bootstrap.Client.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/client/Bootstrap.Client/Controllers/Api/InterfaceController.cs b/src/client/Bootstrap.Client/Controllers/Api/InterfaceController.cs index 30d33672..9a5f717b 100644 --- a/src/client/Bootstrap.Client/Controllers/Api/InterfaceController.cs +++ b/src/client/Bootstrap.Client/Controllers/Api/InterfaceController.cs @@ -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); } diff --git a/src/client/Bootstrap.Client/appsettings.Development.json b/src/client/Bootstrap.Client/appsettings.Development.json index 9e8fe519..30955a4f 100644 --- a/src/client/Bootstrap.Client/appsettings.Development.json +++ b/src/client/Bootstrap.Client/appsettings.Development.json @@ -48,6 +48,8 @@ }, "SmtpClient": { "Host": "smtp.163.com", + "Port": 587, + "EnableSsl": true, "Password": "", "From": "honeywell_mes@163.com", "To": "argo@163.com" diff --git a/src/client/Bootstrap.Client/appsettings.json b/src/client/Bootstrap.Client/appsettings.json index 427b72d9..804532fe 100644 --- a/src/client/Bootstrap.Client/appsettings.json +++ b/src/client/Bootstrap.Client/appsettings.json @@ -43,6 +43,8 @@ }, "SmtpClient": { "Host": "smtp.163.com", + "Port": 587, + "EnableSsl": true, "Password": "", "From": "honeywell_mes@163.com", "To": "argo@163.com" diff --git a/src/client/Bootstrap.Client/wwwroot/lib/longbow-select/longbow-select.css b/src/client/Bootstrap.Client/wwwroot/lib/longbow-select/longbow-select.css index 6ea594a0..ffdb1968 100644 --- a/src/client/Bootstrap.Client/wwwroot/lib/longbow-select/longbow-select.css +++ b/src/client/Bootstrap.Client/wwwroot/lib/longbow-select/longbow-select.css @@ -50,6 +50,10 @@ cursor: not-allowed; } +.form-select.is-disabled .form-select-append { + color: #c0c4cc; +} + .form-select-input { color: #606266; outline: none; diff --git a/src/client/Bootstrap.Client/wwwroot/lib/longbow-select/longbow-select.js b/src/client/Bootstrap.Client/wwwroot/lib/longbow-select/longbow-select.js index 6001c350..2b3d9e7a 100644 --- a/src/client/Bootstrap.Client/wwwroot/lib/longbow-select/longbow-select.js +++ b/src/client/Bootstrap.Client/wwwroot/lib/longbow-select/longbow-select.js @@ -75,7 +75,7 @@ // 新控件
    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 = $(''); @@ -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 = $('').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 = $('' + this.text + ''); 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');