コード例 #1
0
        public async Task <IActionResult> VerifyCode([FromBody] VerifyCodeModel options)
        {
            try
            {
                var result = await _resetPasswordService.ValidateConfirmationCodeAsync(options.Email, options.Code);

                return(Ok(new ResetTokenResponse {
                    ResetToken = result
                }));
            }
            catch (KeyNotFoundException)
            {
                return(NotFound());
            }
            catch (ArgumentException ex)
            {
                if (ex.Message == Consts.ErrorReponses.CodeIsNotValid)
                {
                    return(BadRequest(new ValidationProblemDetails(new Dictionary <string, string[]>(new List <KeyValuePair <string, string[]> > {
                        new KeyValuePair <string, string[]>("Code", new string[] { "Code is not valid" })
                    }))));
                }

                throw ex;
            }
        }