aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-12-14 10:38:08 +0100
committerivarlovlie <git@ivarlovlie.no>2022-12-14 10:38:08 +0100
commit2f7da902c9afeb3df31f59fa6c16223990f51eb6 (patch)
treeda258139ba2ef663a3061f00bbf7257ef723b958 /code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs
parent0557de9f069dc620539409aced67e2ad61d25395 (diff)
downloadgreatoffice-2f7da902c9afeb3df31f59fa6c16223990f51eb6.tar.xz
greatoffice-2f7da902c9afeb3df31f59fa6c16223990f51eb6.zip
feat: Working email validation
Diffstat (limited to 'code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs')
-rw-r--r--code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs10
1 files changed, 5 insertions, 5 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