aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/src/Endpoints
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-12-11 20:46:58 +0100
committerivarlovlie <git@ivarlovlie.no>2022-12-11 20:47:06 +0100
commit6561771c435f9d9bed1589b5ed13d17aee0b7873 (patch)
tree2c47e60fa4aaaa5bf1e151838ac197a61f4377cc /code/api/src/Endpoints
parent8da37c77cae0c7f712a775e3996afd9d84b0f9af (diff)
downloadgreatoffice-6561771c435f9d9bed1589b5ed13d17aee0b7873.tar.xz
greatoffice-6561771c435f9d9bed1589b5ed13d17aee0b7873.zip
feat: Add frontpage
Diffstat (limited to 'code/api/src/Endpoints')
-rw-r--r--code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs1
-rw-r--r--code/api/src/Endpoints/Internal/Root/IsAuthenticatedRoute.cs (renamed from code/api/src/Endpoints/Internal/Root/ValidSessionRoute.cs)4
-rw-r--r--code/api/src/Endpoints/Internal/Root/ValidateRoute.cs25
3 files changed, 28 insertions, 2 deletions
diff --git a/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs b/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs
index 44b8376..c114bb8 100644
--- a/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs
+++ b/code/api/src/Endpoints/Internal/Account/CreateAccountRoute.cs
@@ -46,6 +46,7 @@ public class CreateAccountRoute : RouteBaseAsync.WithRequest<CreateAccountRoute.
_database.Users.Add(user);
await _database.SaveChangesAsync(cancellationToken);
await _userService.LogInUser(HttpContext, user);
+ Task.Run(() => _userService.SendValidationEmail(user), cancellationToken);
return Ok();
}
} \ No newline at end of file
diff --git a/code/api/src/Endpoints/Internal/Root/ValidSessionRoute.cs b/code/api/src/Endpoints/Internal/Root/IsAuthenticatedRoute.cs
index f377ff6..7bb0a86 100644
--- a/code/api/src/Endpoints/Internal/Root/ValidSessionRoute.cs
+++ b/code/api/src/Endpoints/Internal/Root/IsAuthenticatedRoute.cs
@@ -1,9 +1,9 @@
namespace IOL.GreatOffice.Api.Endpoints.Internal.Root;
-public class ValidSessionRoute : RouteBaseSync.WithoutRequest.WithActionResult
+public class IsAuthenticatedRoute : RouteBaseSync.WithoutRequest.WithActionResult
{
[Authorize]
- [HttpGet("~/_/valid-session")]
+ [HttpGet("~/_/is-authenticated")]
public override ActionResult Handle() {
return Ok();
}
diff --git a/code/api/src/Endpoints/Internal/Root/ValidateRoute.cs b/code/api/src/Endpoints/Internal/Root/ValidateRoute.cs
new file mode 100644
index 0000000..682a869
--- /dev/null
+++ b/code/api/src/Endpoints/Internal/Root/ValidateRoute.cs
@@ -0,0 +1,25 @@
+namespace IOL.GreatOffice.Api.Endpoints.Internal.Root;
+
+public class ValidateRoute : RouteBaseSync.WithRequest<ValidateRoute.QueryParams>.WithActionResult
+{
+ private readonly UserService _userService;
+ private readonly string _continueTo;
+
+ public ValidateRoute(UserService userService, VaultService vaultService) {
+ _userService = userService;
+ var c = vaultService.GetCurrentAppConfiguration();
+ _continueTo = c.CANONICAL_FRONTEND_URL + "/?act=email-validated";
+ }
+
+ public class QueryParams
+ {
+ [FromQuery]
+ public Guid Id { get; set; }
+ }
+
+ [HttpGet("~/_/validate")]
+ public override ActionResult Handle([FromQuery] QueryParams request) {
+ _userService.FulfillEmailValidationRequest(request.Id, LoggedInUser.Id);
+ return Redirect(_continueTo);
+ }
+} \ No newline at end of file