1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- 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<ActionResult<AuthResponse>> Login(AuthRequest request)
- {
- return Ok( await _authenticationService.Login(request));
- }
- [HttpPost("register")]
- [Consumes("multipart/form-data")]
- public async Task<ActionResult<UserDto>> Register([FromForm] UserDto input)
- {
- return await _userService.Create(input);
- }
- [HttpGet("forgetPasswordMail")]
- //[ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult<ForgetPasswordResponseDto>> ForgetPasswordMail([FromQuery] string email)
- {
- var result = await _userService.ForgetPasswordMail(email);
- return result;
- }
- [HttpPost("forgetPassword")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult> ForgetPassword([FromBody] ForgetPasswordDto model)
- {
- return Ok( await _userService.ForgetPassword(model));
- }
- [HttpPost("VerifyOTP")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult> VerifyOTP([FromBody] VerifyOTPDto model)
- {
- var result = await _userService.VerifyOTP(model);
- return Ok(result);
- }
-
- [HttpGet("confirmEmail")]
- [ProducesResponseType(StatusCodes.Status200OK)]
- public async Task<ActionResult> ConfirmEmail([FromQuery] ConfirmEmailDto model)
- {
- var result = await _userService.ConfirmEmail(model);
- return Ok(result);
- }
- }
- }
|