aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs')
-rw-r--r--server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs34
1 files changed, 0 insertions, 34 deletions
diff --git a/server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs b/server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs
deleted file mode 100644
index 13fbdf4..0000000
--- a/server/src/Endpoints/Internal/Account/CreateInitialAccountRoute.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-namespace IOL.GreatOffice.Api.Endpoints.Internal.Account;
-
-/// <inheritdoc />
-public class CreateInitialAccountRoute : RouteBaseAsync.WithoutRequest.WithActionResult
-{
- private readonly AppDbContext _context;
- private readonly UserService _userService;
-
- /// <inheritdoc />
- public CreateInitialAccountRoute(AppDbContext context, UserService userService) {
- _context = context;
- _userService = userService;
- }
-
- /// <summary>
- /// Create an initial user account.
- /// </summary>
- /// <param name="cancellationToken"></param>
- /// <returns></returns>
- [AllowAnonymous]
- [HttpGet("~/_/account/create-initial")]
- public override async Task<ActionResult> HandleAsync(CancellationToken cancellationToken = default) {
- if (_context.Users.Any()) {
- return NotFound();
- }
-
- var user = new User("admin@ivarlovlie.no");
- user.HashAndSetPassword("ivar123");
- _context.Users.Add(user);
- await _context.SaveChangesAsync(cancellationToken);
- await _userService.LogInUser(HttpContext, user);
- return Redirect("/");
- }
-}