From 6561771c435f9d9bed1589b5ed13d17aee0b7873 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sun, 11 Dec 2022 20:46:58 +0100 Subject: feat: Add frontpage --- .../Internal/Account/CreateAccountRoute.cs | 1 + .../Internal/Root/IsAuthenticatedRoute.cs | 10 +++++++++ .../Endpoints/Internal/Root/ValidSessionRoute.cs | 10 --------- .../src/Endpoints/Internal/Root/ValidateRoute.cs | 25 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 code/api/src/Endpoints/Internal/Root/IsAuthenticatedRoute.cs delete mode 100644 code/api/src/Endpoints/Internal/Root/ValidSessionRoute.cs create mode 100644 code/api/src/Endpoints/Internal/Root/ValidateRoute.cs (limited to 'code/api/src/Endpoints') 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 _userService.SendValidationEmail(user), cancellationToken); return Ok(); } } \ No newline at end of file diff --git a/code/api/src/Endpoints/Internal/Root/IsAuthenticatedRoute.cs b/code/api/src/Endpoints/Internal/Root/IsAuthenticatedRoute.cs new file mode 100644 index 0000000..7bb0a86 --- /dev/null +++ b/code/api/src/Endpoints/Internal/Root/IsAuthenticatedRoute.cs @@ -0,0 +1,10 @@ +namespace IOL.GreatOffice.Api.Endpoints.Internal.Root; + +public class IsAuthenticatedRoute : RouteBaseSync.WithoutRequest.WithActionResult +{ + [Authorize] + [HttpGet("~/_/is-authenticated")] + public override ActionResult Handle() { + 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/ValidSessionRoute.cs deleted file mode 100644 index f377ff6..0000000 --- a/code/api/src/Endpoints/Internal/Root/ValidSessionRoute.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace IOL.GreatOffice.Api.Endpoints.Internal.Root; - -public class ValidSessionRoute : RouteBaseSync.WithoutRequest.WithActionResult -{ - [Authorize] - [HttpGet("~/_/valid-session")] - public override ActionResult Handle() { - return Ok(); - } -} \ No newline at end of file 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.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 -- cgit v1.3