Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/ClientManager.Application/AuthApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ClientManager.Application.Mappers;
using ClientManager.Domain.Core.Interfaces.Services;
using ClientManager.Domain.Core.Responses;
using FluentValidation;

Expand Down Expand Up @@ -52,6 +53,18 @@ public AuthApplication(

await _userService.AddUserAsync(user).ConfigureAwait(false);

_ = Task.Run(async () =>
{
try
{
await _emailService.SendWelcomeEmailAsync(user.Email, user.Username).ConfigureAwait(false);
}
catch
{
// fire-and-forget: email failure should not block registration
}
});

var token = _tokenService.GenerateToken(user.Id, user.Username, user.Email, user.Role);
var refreshToken = _tokenService.GenerateRefreshToken();
_refreshTokens[refreshToken] = user.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task SendWelcomeEmailAsync(string email, string name, byte[]? attac
public async Task SendWelcomeEmailToUserAsync(string email, string username)
{
var host = configuration["Smtp:Host"];
var port = int.Parse(configuration["Smtp:Port"] ?? "587");
var port = int.Parse(configuration["Smtp:Port"] ?? "587", CultureInfo.InvariantCulture);
var username2 = configuration["Smtp:Username"];
var password = configuration["Smtp:Password"];
var fromEmail = configuration["Smtp:FromEmail"] ?? "no-reply@clientmanager.com";
Expand Down
Loading