using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using MTWorkHR.Application.Filters; using MTWorkHR.Application.Identity; using MTWorkHR.Application.Models; using MTWorkHR.Core.Global; using MTWorkHR.Identity.Services; namespace MTWorkHR.API.Controllers { [Route("api/[controller]")] [ApiController] public class AuthController : ControllerBase { private readonly IAuthService _authenticationService; private readonly IUserService _userService; public AuthController(IAuthService authenticationService, IUserService userService) { _authenticationService = authenticationService; _userService = userService; } [HttpPost("login")] public async Task> Login(AuthRequest request) { return Ok( await _authenticationService.Login(request)); } [HttpPost("register")] public async Task> Register([FromBody] UserDto input) { return await _userService.Create(input); } //[HttpPost("IsExpiredToken")] //[ProducesResponseType(StatusCodes.Status200OK)] //public async Task IsExpiredToken([FromBody] ForgetPasswordDto model) //{ // return await _userService.IsExpiredToken(model); //} [HttpPost("forgetPasswordMail")] [ProducesResponseType(StatusCodes.Status200OK)] public async Task ForgetPasswordMail(string userId) { await _userService.ForgetPasswordMail(userId); } [HttpPost("forgetPassword")] [ProducesResponseType(StatusCodes.Status200OK)] public async Task ForgetPassword([FromBody] ForgetPasswordDto model) { return await _userService.ForgetPassword(model); } [HttpGet("confirmEmail")] [ProducesResponseType(StatusCodes.Status200OK)] public async Task ConfirmEmail(ForgetPasswordDto model) { var result = await _userService.ConfirmEmail(model); return result; } } }