1
This commit is contained in:
@@ -53,76 +53,112 @@ namespace FineUIPro.Web
|
||||
protected void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//string userName = this.tbxUserName.Text;
|
||||
//string password = this.tbxPassword.Text;
|
||||
//bool rememberMe = this.savemessgae.Checked;
|
||||
//bool isLogin = false;
|
||||
//using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
//{
|
||||
// var sysUser = 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;
|
||||
// }
|
||||
// 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);
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
string userName = this.tbxUserName.Text;
|
||||
string password = this.tbxPassword.Text;
|
||||
bool rememberMe = this.savemessgae.Checked;
|
||||
bool isLogin = false;
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
///登陆信息是否正确
|
||||
if (BLL.Sys_UserService.UserLogOn(userName, password, rememberMe, this.Page))
|
||||
{
|
||||
var sysUser = 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;
|
||||
}
|
||||
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);
|
||||
return;
|
||||
}
|
||||
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");
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.Show("账户与密码不匹配", MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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/;"/>
|
||||
|
||||
Reference in New Issue
Block a user