/** * 检查是否为恶意点击发送短信 */ protected bool CheckIpSendOutLimit() { //检查同一个IP每天最多只能发5条 GetUserVerifyInput filterInput = new GetUserVerifyInput() { CreationTime = DateTime.Today, ExpirationTime = DateTime.Today.AddDays(1), Ip = RequestIp }; var list = _userVerifyAppService.GetPagedUserVerifysAsync(filterInput); return(list.Result.TotalCount > 5); }
public async Task <AjaxResponse> ResetPassword(ResetModel model) { if (AbpSession.UserId == null || AbpSession.UserId.Value == 0) { ErrorInfo error = new ErrorInfo() { Code = 100007 }; return(new AjaxResponse(error)); } var userAuthCodeVerify = _userVerifyAppService.GetPagedUserVerifysAsync( new GetUserVerifyInput() { AuthCode = model.AuthCode, PhoneNumber = model.PhoneNumber, VerifyStatus = CodeVerifyStatus.Success, PurposeType = PurposeType.ResetPassword }).Result; if (userAuthCodeVerify.TotalCount > 0) { try { long userId = AbpSession.UserId.Value; var user = await _userManager.GetUserByIdAsync(userId); var identityResult = await _userManager.ChangePasswordAsync(user, model.NewPassword); CheckErrors(identityResult); } catch (UserFriendlyException ex) { return(new AjaxResponse(new ErrorInfo("保存失败"))); } return(new AjaxResponse(new { flag = true, msg = "成功" })); } return(new AjaxResponse(new ErrorInfo("保存失败"))); }