public async Task <bool> ResendCode([FromBody] ResendCodeRequest request) { if (!request.Key.IsValidPartitionOrRowKey()) { return(false); } if (string.IsNullOrEmpty(request.Captcha) || !await _recaptchaService.Validate(request.Captcha)) { return(false); } var code = await _verificationCodesRepository.GetCodeAsync(request.Key); if (code == null || code.ResendCount > 2) { return(false); } code = await _verificationCodesRepository.UpdateCodeAsync(request.Key); var url = Url.Action("Signup", "Authentication", new { key = code.Key }, Request.Scheme); await _emailFacadeService.SendVerifyCode(code.Email, code.Code, url); return(true); }
public IActionResult ResendCode([FromBody] ResendCodeRequest request) { var success = UserLogic.Instance.ResendCode(request.Phone); if (success) { return(Ok()); } else { return(NoContent()); } }
public async Task <ResendCodeResult> ResendCode([FromBody] ResendCodeRequest request) { var result = new ResendCodeResult(); if (!request.Key.IsValidPartitionOrRowKey()) { return(result); } if (string.IsNullOrEmpty(request.Captcha) || !await _recaptchaService.Validate(request.Captcha)) { return(result); } var code = await _verificationCodesService.GetCodeAsync(request.Key); if (code == null) { return(ResendCodeResult.Expired); } if (code.ResendCount > 2) { return(result); } code = await _verificationCodesService.UpdateCodeAsync(request.Key); if (code == null) { return(ResendCodeResult.Expired); } var url = Url.Action("Signup", "Authentication", new { key = code.Key }, Request.Scheme); await _emailFacadeService.SendVerifyCode(code.Email, code.Code, url); result.Result = true; return(result); }