Пример #1
0
        public async Task <IActionResult> ArchiveUser(string id)
        {
            var callerId = GetIdFromClaims();

            if (callerId != id)
            {
                return(BadRequest("You can only archive your own account."));
            }

            await _userService.Archive(id);

            var user = await _userService.GetUser(id);

            var email = EmailTemplates.GetArchivedAccountEmail();
            await _emailService.SendAsync(user.Email, "Archived Account", email);

            _logger.LogInformation("Forgot password email sent successfully.");

            return(Ok());
        }