public async Task <ForgotPwdResult> DoForgotPwd(ForgotPwdInfo request) { try { if (!Misc.IsValidEmailAdress(request.EMail)) { throw new Exception("Invalid eMail!"); } var lastSendTime = (DateTime.UtcNow - _lastTime).TotalSeconds; if (lastSendTime <= 90) { throw new Exception( $"You need to wait at least 90 seconds before asking to resend an confirmation key! Last request was {lastSendTime} seconds ago."); } dynamic requestInfo = request; var result = await DataExchange.DoDataExchange((object)requestInfo); ForgotPwdResult retVal = result.ToObject <ForgotPwdResult>(); if (retVal.Result) { _lastTime = DateTime.UtcNow; } return(retVal); } catch (Exception e) { return(new ForgotPwdResult(false, e.Message)); } }
public async Task <ForgotPwdResult> DoForgotPwd(ForgotPwdInfo request) { try { var lastSendTime = (DateTime.UtcNow - _lastTime).TotalSeconds; if (lastSendTime <= 90) { throw new Exception( $"You need to wait at least 90 seconds before asking to resend an confirmation key! Last request was {lastSendTime} seconds ago."); } var result = await _dataExchange.DoDataExchange <ForgotPwdResult, ForgotPwdInfo>(request, CmdName); if (result.Result) { _lastTime = DateTime.UtcNow; } return(result); } catch (Exception e) { return(new ForgotPwdResult(false, e.Message)); } }