Exemplo n.º 1
0
        public async Task <IActionResult> RestorePassword([FromRoute] string userId, [FromBody] PasswordRestoreDto restoreDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            User user = await _accountBl.FindByIdAsync(userId);

            if (user == null)
            {
                return(BadRequest("There is no User with that ID "));
            }
            else
            {
                await _accountBl.ResetPasswordAsync(user, restoreDto);
            }
            return(Ok("Password restored successfully."));
        }