20230806修改账号的密码安全策略
This commit is contained in:
@@ -48,7 +48,7 @@ namespace BLL
|
||||
/// <summary>
|
||||
/// 默认用户密码
|
||||
/// </summary>
|
||||
public const string Password = "123";
|
||||
// public const string Password = "123";
|
||||
|
||||
/// <summary>
|
||||
/// 默认用户密码
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user