20230806修改账号的密码安全策略

This commit is contained in:
2023-08-06 22:38:05 +08:00
parent f13d77c520
commit 2804d7c4df
15 changed files with 189 additions and 174 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ namespace BLL
/// <summary>
/// 默认用户密码
/// </summary>
public const string Password = "123";
// public const string Password = "123";
/// <summary>
/// 默认用户密码
+70
View File
@@ -165,6 +165,76 @@ namespace BLL
//return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
}
#region
/// <summary>
/// 获取用户初始密码
/// </summary>
/// <param name="password"></param>
/// <returns></returns>
public static string getInitialPassword(string unitId, string idCard)
{
string prefixValue = "sedin";
string suffixValue = "1234";
//var getUnit = UnitService.GetUnitByUnitId(unitId);
//if (getUnit != null)
//{
// if (!string.IsNullOrEmpty(getUnit.UnitCode))
// {
// if (getUnit.UnitCode.Length > 10)
// {
// prefixValue = getUnit.UnitCode.Substring(getUnit.UnitCode.Length - 10);
// }
// else
// {
// prefixValue = getUnit.UnitCode;
// }
// }
//}
if (!string.IsNullOrEmpty(idCard))
{
if (idCard.Length > 4)
{
suffixValue = idCard.Substring(idCard.Length - 4);
}
else
{
suffixValue = idCard;
}
}
return prefixValue + "." + suffixValue;
}
#endregion
#region
/// <summary>
///
/// </summary>
/// <param name="c"></param>
/// <returns></returns>
public static bool IsLetter(char c)
{
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
public static bool IsDigit(char c)
{
return c >= '0' && c <= '9';
}
static bool IsSymbol(char c)
{
return c > 32 && c < 127 && !IsDigit(c) && !IsLetter(c);
}
public static bool IsValIDPassword(string password)
{
return
password.Any(c => IsLetter(c)) &&
password.Any(c => IsDigit(c)) &&
password.Any(c => IsSymbol(c));
}
#endregion
/// <summary>
/// 为目标下拉框加上 "请选择" 项
/// </summary>