修复账户登录失败,服务器不进行失败计数的BUG,v1.4.8

This commit is contained in:
dathlin
2017-09-24 20:53:38 +08:00
parent e8a72078c3
commit f226e00fb9
2 changed files with 20 additions and 6 deletions

View File

@@ -13,6 +13,8 @@ namespace CommonLibrary
/// <typeparam name="T">账户类该类必须派生自UserAccount类</typeparam>
public class ServerAccounts<T> : HslCommunication.BasicFramework.SoftFileSaveBase where T : UserAccount, new()
{
#region Constructor
/// <summary>
/// 初始化构造方法
/// </summary>
@@ -28,14 +30,20 @@ namespace CommonLibrary
all_list_accounts.AddRange(accounts);
}
#endregion
#region Private Member
private List<T> all_list_accounts = new List<T>();
/// <summary>
/// 一个简单的混合锁相比Lock速度更快
/// </summary>
private HslCommunication.SimpleHybirdLock hybirdLock = new HslCommunication.SimpleHybirdLock();
#endregion
#region Public Method
/// <summary>
/// 更新指定账户的密码
/// </summary>
@@ -126,6 +134,7 @@ namespace CommonLibrary
{
if (item.Password != code)
{
item.LoginFailedCount++;
result.ForbidMessage = "密码错误!";
break;
}
@@ -161,7 +170,7 @@ namespace CommonLibrary
/// 新增一个账户如果账户名称已经存在则返回False注册成功返回True
/// </summary>
/// <param name="account">账户对象</param>
/// <returns>成功True,失败False</returns>
/// <returns>成功<c>True</c>,失败<c>False</c></returns>
public bool AddNewAccount(T account)
{
bool result = true;
@@ -246,7 +255,9 @@ namespace CommonLibrary
hybirdLock.Leave();
}
#endregion
#region Override Method
@@ -280,5 +291,8 @@ namespace CommonLibrary
{
SaveToFile(m => m);
}
#endregion
}
}

View File

@@ -43,7 +43,7 @@ namespace CommonLibrary
*
**************************************************************************/
SoftBasic.FrameworkVersion = new SystemVersion("1.4.7");
SoftBasic.FrameworkVersion = new SystemVersion("1.4.8");
}