diff --git a/DataBase/版本日志/HJGLDB_DS_2025-10-27_gf.sql b/DataBase/版本日志/HJGLDB_DS_2025-10-27_gf.sql new file mode 100644 index 0000000..f19dcaf --- /dev/null +++ b/DataBase/版本日志/HJGLDB_DS_2025-10-27_gf.sql @@ -0,0 +1,3 @@ +alter table Sys_User add LockTime datetime null +alter table Sys_User add ErrorTimes int null +GO \ No newline at end of file diff --git a/HJGL_DS/BLL/Common/SysManage/Sys_UserService.cs b/HJGL_DS/BLL/Common/SysManage/Sys_UserService.cs index 0d5e8ac..d55a84e 100644 --- a/HJGL_DS/BLL/Common/SysManage/Sys_UserService.cs +++ b/HJGL_DS/BLL/Common/SysManage/Sys_UserService.cs @@ -357,6 +357,8 @@ namespace BLL newUser.AllowLoginSystem = user.AllowLoginSystem; newUser.Phone = user.Phone; newUser.SignatureUrl = user.SignatureUrl; + newUser.LockTime = user.LockTime; + newUser.ErrorTimes = user.ErrorTimes; db.SubmitChanges(); } diff --git a/HJGL_DS/FineUIPro.Web/Login.aspx.cs b/HJGL_DS/FineUIPro.Web/Login.aspx.cs index 02133de..624bb35 100644 --- a/HJGL_DS/FineUIPro.Web/Login.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/Login.aspx.cs @@ -7,6 +7,7 @@ using System.IO; using System.Text; using System.Security.Cryptography; using CodeName.APPa; +using System.Linq; namespace FineUIPro.Web { @@ -53,38 +54,70 @@ namespace FineUIPro.Web string password = this.tbxPassword.Text; bool rememberMe = this.savemessgae.Checked; bool isLogin = false; - ///登陆信息是否正确 - if (BLL.Sys_UserService.UserLogOn(userName, password, rememberMe, this.Page)) + var sysUser = Funs.DB.Sys_User.FirstOrDefault(x => x.Account == userName && x.IsPost == true); + if (sysUser != null) { - isLogin = true; - } - //else - //{ - // ////检查域名是否存在 - // var admoain = BLL.ADomainService.IsConnected(Funs.ADomainUrl, userName, BLL.CommonService.Base64Code(password)); - // if (admoain != null) - // { - // if (BLL.Sys_UserService.ADUserLogOn(userName, rememberMe, this.Page)) - // { - // isLogin = true; - // } - // else - // { - // Alert.Show("当前用户不在岗", MessageBoxIcon.Warning); - // return; - // } - // } - //} - if (isLogin) - { - BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "登陆成功!"); - Response.Redirect("~/default.aspx"); + if (sysUser.LockTime.HasValue && sysUser.LockTime.Value > DateTime.Now) + { + Alert.Show("账号锁定30分钟!", MessageBoxIcon.Error); + return; + } + else + { + if (sysUser.Password.ToUpper() != Sys_UserService.EncryptionPassword(password).ToUpper()) + { + if (sysUser.LockTime.HasValue && sysUser.LockTime.Value < DateTime.Now) + { + sysUser.ErrorTimes = null; + sysUser.LockTime = null; + Sys_UserService.UpdateUser(sysUser); + } + if (sysUser.ErrorTimes.HasValue && sysUser.ErrorTimes.Value >= 4) + { + sysUser.ErrorTimes = sysUser.ErrorTimes.Value + 1; + sysUser.LockTime = DateTime.Now.AddMinutes(30); + Sys_UserService.UpdateUser(sysUser); + Alert.Show("账号锁定30分钟!", MessageBoxIcon.Error); + return; + } + else if (sysUser.ErrorTimes.HasValue) + { + sysUser.ErrorTimes = sysUser.ErrorTimes.Value + 1; + Sys_UserService.UpdateUser(sysUser); + // error = "密码错误" + sysUser.ErrorTimes + "次,超过5次将锁定10分钟!"; + Alert.Show("用户名或密码错误,超过5次将锁定30分钟,请重新输入!", MessageBoxIcon.Error); + return; + } + else + { + sysUser.ErrorTimes = 1; + Sys_UserService.UpdateUser(sysUser); + Alert.Show("用户名或密码错误,超过5次将锁定30分钟,请重新输入!", MessageBoxIcon.Error); + return; + } + } + ///登陆信息是否正确 + if (BLL.Sys_UserService.UserLogOn(userName, password, rememberMe, this.Page)) + { + isLogin = true; + } + if (isLogin) + { + BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "登陆成功!"); + Response.Redirect("~/default.aspx"); + } + else + { + Alert.Show("账户与密码不匹配!", MessageBoxIcon.Error); + return; + } + } } else { - Alert.Show("账户与密码不匹配", MessageBoxIcon.Error); + Alert.Show("用户名或密码错误,请重新输入!", MessageBoxIcon.Error); return; - } + } } /// diff --git a/HJGL_DS/FineUIPro.Web/Web.config b/HJGL_DS/FineUIPro.Web/Web.config index 5c46a5b..e233efb 100644 --- a/HJGL_DS/FineUIPro.Web/Web.config +++ b/HJGL_DS/FineUIPro.Web/Web.config @@ -11,7 +11,7 @@ - + diff --git a/HJGL_DS/Model/Model.cs b/HJGL_DS/Model/Model.cs index a484531..d6a9378 100644 --- a/HJGL_DS/Model/Model.cs +++ b/HJGL_DS/Model/Model.cs @@ -61914,7 +61914,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WED_Code", DbType="NVarChar(41) NOT NULL", CanBeNull=false)] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WED_Code", DbType="VarChar(41)")] public string WED_Code { get @@ -62010,7 +62010,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RTReport", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RTReport", DbType="NVarChar(100)")] public string RTReport { get @@ -62042,7 +62042,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UTReport", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UTReport", DbType="NVarChar(100)")] public string UTReport { get @@ -62074,7 +62074,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MTReport", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MTReport", DbType="NVarChar(100)")] public string MTReport { get @@ -62106,7 +62106,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PTReport", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PTReport", DbType="NVarChar(100)")] public string PTReport { get @@ -62411,7 +62411,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WED_Code", DbType="NVarChar(41) NOT NULL", CanBeNull=false)] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WED_Code", DbType="VarChar(41)")] public string WED_Code { get @@ -100541,6 +100541,10 @@ namespace Model private string _IdCard; + private System.Nullable _LockTime; + + private System.Nullable _ErrorTimes; + private EntitySet _Base_Project; private EntitySet _Common_NoticeSign; @@ -100629,6 +100633,10 @@ namespace Model partial void OnSignatureUrlChanged(); partial void OnIdCardChanging(string value); partial void OnIdCardChanged(); + partial void OnLockTimeChanging(System.Nullable value); + partial void OnLockTimeChanged(); + partial void OnErrorTimesChanging(System.Nullable value); + partial void OnErrorTimesChanged(); #endregion public Sys_User() @@ -101051,6 +101059,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LockTime", DbType="DateTime")] + public System.Nullable LockTime + { + get + { + return this._LockTime; + } + set + { + if ((this._LockTime != value)) + { + this.OnLockTimeChanging(value); + this.SendPropertyChanging(); + this._LockTime = value; + this.SendPropertyChanged("LockTime"); + this.OnLockTimeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ErrorTimes", DbType="Int")] + public System.Nullable ErrorTimes + { + get + { + return this._ErrorTimes; + } + set + { + if ((this._ErrorTimes != value)) + { + this.OnErrorTimesChanging(value); + this.SendPropertyChanging(); + this._ErrorTimes = value; + this.SendPropertyChanged("ErrorTimes"); + this.OnErrorTimesChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Base_Project_Sys_User", Storage="_Base_Project", ThisKey="UserId", OtherKey="CreateManId", DeleteRule="NO ACTION")] public EntitySet Base_Project {