12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- namespace WingServerCommon.Interfaces.PasswordVerify
- {
- /// <summary>
- /// 用户密码验证管理类
- /// </summary>
- public class UserPasswordExpireVerify : PasswordExpireVerify
- {
- /// <summary>
- /// 用户密码验证有参构造
- /// </summary>
- public UserPasswordExpireVerify(Func<IList<string>, IList<PasswordVerifyModel>> loadDatasFunc, bool isOpen = true) : base(loadDatasFunc)
- {
- VerifyUserPasswordListen(1, isOpen);
- }
- /// <summary>
- /// 登录验证密码是否有效
- /// </summary>
- /// <param name="tokenList">用户数据</param>
- /// <returns>验证结果</returns>
- public VerifyBaseModel VerifyPasswordExpire(PasswordVerifyModel query)
- {
- var verifyResult = new VerifyBaseModel();
- if (query.PasswordLastUpdateTime < Convert.ToDateTime("2000-1-1"))
- {
- return verifyResult;
- }
- verifyResult = VerifyData(query.ClientId, query.PasswordLastUpdateTime);
- return verifyResult;
- }
- /// <summary>
- /// 修改密码,验证是否重复
- /// </summary>
- /// <param name="request">修改请求数据</param>
- /// <returns>是否成功</returns>
- public bool VerifySamePassword(PasswordVerifyModel request)
- {
- var result = false;
- //验证密码是否重复
- if (request.PasswordRecords != null && request.PasswordRecords.Count > 0 &&
- !request.PasswordRecords.Contains(request.NewPassword))
- {
- //没有
- result = true;
- }
- else if (request.PasswordRecords != null && request.PasswordRecords.Count == 0)
- {
- //没有
- result = true;
- }
- return result;
- }
- }
- }
|