This commit is contained in:
高飞 2025-10-27 15:42:44 +08:00
parent 751270c1c6
commit 64cf9e51b6
5 changed files with 120 additions and 34 deletions

View File

@ -0,0 +1,3 @@
alter table Sys_User add LockTime datetime null
alter table Sys_User add ErrorTimes int null
GO

View File

@ -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();
}

View File

@ -7,6 +7,7 @@ using System.IO;
using System.Text;
using System.Security.Cryptography;
using CodeName.APPa;
using System.Linq;
namespace FineUIPro.Web
{
@ -53,28 +54,53 @@ namespace FineUIPro.Web
string password = this.tbxPassword.Text;
bool rememberMe = this.savemessgae.Checked;
bool isLogin = false;
var sysUser = Funs.DB.Sys_User.FirstOrDefault(x => x.Account == userName && x.IsPost == true);
if (sysUser != null)
{
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;
}
//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, "登陆成功!");
@ -82,7 +108,14 @@ namespace FineUIPro.Web
}
else
{
Alert.Show("账户与密码不匹配", MessageBoxIcon.Error);
Alert.Show("账户与密码不匹配!", MessageBoxIcon.Error);
return;
}
}
}
else
{
Alert.Show("用户名或密码错误,请重新输入!", MessageBoxIcon.Error);
return;
}
}

View File

@ -11,7 +11,7 @@
<FineUIPro DebugMode="false" Theme="Cupertino"/>
<appSettings>
<!--连接字符串-->
<add key="ConnectionString" value="Server=.\SQL2022;Database=HJGLDB_DS;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Max Pool Size = 1000;Connect Timeout=1200"/>
<add key="ConnectionString" value="Server=.\MSSQLSERVER01;Database=HJGLDB_DS;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Max Pool Size = 1000;Connect Timeout=1200"/>
<!--系统名称-->
<add key="SystemName" value="诺必达焊接管理系统"/>
<add key="ChartImageHandler" value="storage=file;timeout=20;url=~/Images/;"/>

View File

@ -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<System.DateTime> _LockTime;
private System.Nullable<int> _ErrorTimes;
private EntitySet<Base_Project> _Base_Project;
private EntitySet<Common_NoticeSign> _Common_NoticeSign;
@ -100629,6 +100633,10 @@ namespace Model
partial void OnSignatureUrlChanged();
partial void OnIdCardChanging(string value);
partial void OnIdCardChanged();
partial void OnLockTimeChanging(System.Nullable<System.DateTime> value);
partial void OnLockTimeChanged();
partial void OnErrorTimesChanging(System.Nullable<int> 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<System.DateTime> 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<int> 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> Base_Project
{