...
This commit is contained in:
@@ -7,6 +7,7 @@ using Shared.DTOs;
|
||||
namespace Back.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
@@ -19,12 +20,17 @@ namespace Back.Controllers
|
||||
}
|
||||
[HttpPost("authenticate")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<UserAuthenticationDTO>> Login(Authentication model)
|
||||
public async Task<ActionResult<UserAuthenticationDTO>> Login([FromBody]Authentication model)
|
||||
{
|
||||
if (!ModelState.IsValid) return BadRequest(model);
|
||||
var result = await _servUser.UserAuthentication(model.Username, model.Password);
|
||||
if (result != null) return Ok(result);
|
||||
else return NotFound("کاربری با این مشخصات یافت نشد");
|
||||
}
|
||||
[HttpGet("test")]
|
||||
|
||||
public async Task<ActionResult> test()
|
||||
{
|
||||
return Ok();
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user