diff options
Diffstat (limited to 'code/api/src/Endpoints/Internal/Account')
4 files changed, 7 insertions, 11 deletions
diff --git a/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs b/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs index c114bb8..a145c38 100644 --- a/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs +++ b/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs @@ -1,5 +1,3 @@ -using Microsoft.Extensions.Localization; - namespace IOL.GreatOffice.Api.Endpoints.Internal.Account; public class CreateAccountRoute : RouteBaseAsync.WithRequest<CreateAccountRoute.Payload>.WithActionResult @@ -7,11 +5,13 @@ public class CreateAccountRoute : RouteBaseAsync.WithRequest<CreateAccountRoute. private readonly MainAppDatabase _database; private readonly UserService _userService; private readonly IStringLocalizer<SharedResources> _localizer; + private readonly EmailValidationService _emailValidation; - public CreateAccountRoute(UserService userService, MainAppDatabase database, IStringLocalizer<SharedResources> localizer) { + public CreateAccountRoute(UserService userService, MainAppDatabase database, IStringLocalizer<SharedResources> localizer, EmailValidationService emailValidation) { _userService = userService; _database = database; _localizer = localizer; + _emailValidation = emailValidation; } public class Payload @@ -45,8 +45,8 @@ public class CreateAccountRoute : RouteBaseAsync.WithRequest<CreateAccountRoute. user.HashAndSetPassword(request.Password); _database.Users.Add(user); await _database.SaveChangesAsync(cancellationToken); - await _userService.LogInUser(HttpContext, user); - Task.Run(() => _userService.SendValidationEmail(user), cancellationToken); + await _userService.LogInUserAsync(HttpContext, user); + await _emailValidation.SendValidationEmailAsync(user); return Ok(); } }
\ No newline at end of file diff --git a/code/api/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs b/code/api/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs index 56ff9c6..01cad3f 100644 --- a/code/api/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs +++ b/code/api/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs @@ -26,7 +26,7 @@ public class CreateInitialAccountRoute : RouteBaseAsync.WithoutRequest.WithActio user.HashAndSetPassword("ivar123"); _database.Users.Add(user); await _database.SaveChangesAsync(cancellationToken); - await _userService.LogInUser(HttpContext, user); + await _userService.LogInUserAsync(HttpContext, user); return Redirect("/"); } }
\ No newline at end of file diff --git a/code/api/src/Endpoints/Internal/Account/LoginRoute.cs b/code/api/src/Endpoints/Internal/Account/LoginRoute.cs index eaebc2a..8a3dff4 100644 --- a/code/api/src/Endpoints/Internal/Account/LoginRoute.cs +++ b/code/api/src/Endpoints/Internal/Account/LoginRoute.cs @@ -1,5 +1,3 @@ -using Microsoft.Extensions.Localization; - namespace IOL.GreatOffice.Api.Endpoints.Internal.Account; public class LoginRoute : RouteBaseAsync.WithRequest<LoginRoute.Payload>.WithActionResult @@ -29,7 +27,7 @@ public class LoginRoute : RouteBaseAsync.WithRequest<LoginRoute.Payload>.WithAct return KnownProblem(_localizer["Invalid username or password"]); } - await _userService.LogInUser(HttpContext, user, request.Persist); + await _userService.LogInUserAsync(HttpContext, user, request.Persist); return Ok(); } }
\ No newline at end of file diff --git a/code/api/src/Endpoints/Internal/Account/UpdateAccountRoute.cs b/code/api/src/Endpoints/Internal/Account/UpdateAccountRoute.cs index c75e750..1081240 100644 --- a/code/api/src/Endpoints/Internal/Account/UpdateAccountRoute.cs +++ b/code/api/src/Endpoints/Internal/Account/UpdateAccountRoute.cs @@ -1,5 +1,3 @@ -using Microsoft.Extensions.Localization; - namespace IOL.GreatOffice.Api.Endpoints.Internal.Account; public class UpdateAccountRoute : RouteBaseAsync.WithRequest<UpdateAccountRoute.Payload>.WithActionResult |
