20220726 修改密码策略

This commit is contained in:
2022-07-26 13:51:21 +08:00
parent 0f7638febc
commit 31efa1eac9
13 changed files with 277 additions and 57 deletions
@@ -105,7 +105,12 @@
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
BLL.UserService.UpdatePassword(rowID, BLL.Const.Password);
var getUser = UserService.GetUserByUserId(rowID);
if (getUser != null)
{
string password = Funs.getInitialPassword(getUser.UnitId, getUser.IdentityCard);
BLL.UserService.UpdatePassword(rowID, password);
}
}
BindGrid();
ShowNotify("密码已重置为原始密码!", MessageBoxIcon.Success);
@@ -89,6 +89,22 @@ namespace FineUIPro.Web.SysManage
return;
}
if (this.txtNewPassword.Text.Length < 8)
{
Alert.ShowInParent("密码长度至少8位!");
return;
}
if (this.txtNewPassword.Text != this.txtConfirmPassword.Text)
{
Alert.ShowInParent("确认密码输入不一致!");
return;
}
if (!Funs.IsValIDPassword(this.txtNewPassword.Text))
{
Alert.ShowInParent("密码必须包含字母、数字、特殊符号!");
return;
}
BLL.UserService.UpdatePassword(user.UserId, this.txtNewPassword.Text);
BLL.LogService.AddSys_Log(this.CurrUser, "修改密码", string.Empty, BLL.Const.UserMenuId, Const.BtnModify);
+2 -1
View File
@@ -366,7 +366,8 @@ namespace FineUIPro.Web.SysManage
var getUser = Funs.DB.Sys_User.FirstOrDefault(x => x.Account == userViews[i].Account);
if (getUser == null)
{
newUser.Password = Funs.EncryptionPassword(Const.Password);
newUser.RawPassword = Funs.getInitialPassword(newUser.UnitId, newUser.IdentityCard);
newUser.Password = Funs.EncryptionPassword(newUser.RawPassword);
BLL.UserService.AddUser(newUser);
insertCount++;
}
@@ -235,8 +235,9 @@ namespace FineUIPro.Web.SysManage
}
if (string.IsNullOrEmpty(this.UserId))
{
newUser.Password = Funs.EncryptionPassword(Const.Password);
newUser.UserId = SQLHelper.GetNewID(typeof(Model.Sys_User));
newUser.RawPassword = Funs.getInitialPassword(newUser.UnitId, newUser.IdentityCard);
newUser.Password = Funs.EncryptionPassword(newUser.RawPassword);
newUser.UserId = SQLHelper.GetNewID();
newUser.DataSources = this.CurrUser.LoginProjectId;
UserService.AddUser(newUser);
LogService.AddSys_Log(this.CurrUser, newUser.UserCode, newUser.UserId, BLL.Const.UserMenuId, BLL.Const.BtnAdd);
@@ -324,10 +325,12 @@ namespace FineUIPro.Web.SysManage
/// <param name="e"></param>
protected void btnArrowRefresh_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.UserId))
var getUser = UserService.GetUserByUserId(this.UserId);
if (getUser != null)
{
BLL.UserService.UpdatePassword(this.UserId, BLL.Const.Password);
ShowNotify("密码已重置为原始密码!", MessageBoxIcon.Success);
string passWord = Funs.getInitialPassword(getUser.UnitId, getUser.IdentityCard);
BLL.UserService.UpdatePassword(this.UserId, passWord);
ShowNotify("密码已重置为原始密码!密码为" + passWord, MessageBoxIcon.Success);
}
else
{