public async Task <ApiResult> MobileResetPasssword(MobileResetPassswordInput input) { var returnResult = new ApiResult(); var verifyMobileValidationCodeInput = new VerifyMobileValidationCodeInput { Mobile = input.Mobile, Type = MobileValidationCodeType.ResetPassword, // 重置密码 ValidationCode = input.ValidationCode, }; if (!await _mobileUserService.VerifyMobileValidationCodeAsync(verifyMobileValidationCodeInput, ModelState)) { returnResult.Code = 400; returnResult.Message = ModelState.FirstErrorMessage(); return(returnResult); } await _mobileUserService.FinishVerifyMobileValidationCodeAsync(verifyMobileValidationCodeInput.Mobile, verifyMobileValidationCodeInput.Type, ModelState); if (!await _mobileUserService.ResetPasswordAsync(input, ModelState)) { returnResult.Code = 400; returnResult.Message = ModelState.FirstErrorMessage(); return(returnResult); } returnResult.Code = 200; returnResult.Message = "重置密码成功"; return(returnResult); }
public async Task <bool> ResetPasswordAsync(MobileResetPassswordInput input, ModelStateDictionary modelState) { // 密码加密 var password = UserService.EncryptPassword(input.Password); var userId = await _manager.ResetPasswordAsync(input.Mobile, password, modelState); if (userId <= 0 || !modelState.IsValid) { return(false); } CleanupUserCache(userId); return(true); }
public async Task <bool> ResetPasswordAsync(MobileResetPassswordInput input, ModelStateDictionary modelState) { // 密码加密 var password = UserService.GeneratePassword(input.Password); var userId = await _repository.ResetPasswordAsync(input.Mobile, password, modelState); if (userId <= 0 || !modelState.IsValid) { return(false); } await CleanCache(userId); return(true); }