mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-04-06 02:19:05 +00:00
Refactor authentication services and implement JWT validation logic
This commit is contained in:
@@ -11,8 +11,8 @@ namespace API.Core.Controllers
|
||||
public class AuthController(
|
||||
IRegisterService registerService,
|
||||
ILoginService loginService,
|
||||
IConfirmationService confirmationService)
|
||||
: ControllerBase
|
||||
IConfirmationService confirmationService
|
||||
) : ControllerBase
|
||||
{
|
||||
[HttpPost("register")]
|
||||
public async Task<ActionResult<UserAccount>> Register(
|
||||
@@ -69,13 +69,16 @@ namespace API.Core.Controllers
|
||||
public async Task<ActionResult> Confirm([FromQuery] string token)
|
||||
{
|
||||
var rtn = await confirmationService.ConfirmUserAsync(token);
|
||||
return Ok(new ResponseBody<ConfirmationPayload>
|
||||
{
|
||||
Message = "User with ID " + rtn.userId + " is confirmed.",
|
||||
Payload = new ConfirmationPayload(
|
||||
rtn.userId, rtn.confirmedAt
|
||||
)
|
||||
});
|
||||
return Ok(
|
||||
new ResponseBody<ConfirmationPayload>
|
||||
{
|
||||
Message = "User with ID " + rtn.userId + " is confirmed.",
|
||||
Payload = new ConfirmationPayload(
|
||||
rtn.userId,
|
||||
rtn.confirmedAt
|
||||
),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ using Infrastructure.Repository.UserAccount;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Service.Auth;
|
||||
using Service.UserManagement.User;
|
||||
using Service.Emails;
|
||||
using Service.UserManagement.User;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user