diff options
Diffstat (limited to 'Backend/Api/Api/Controllers/AuthController.cs')
-rw-r--r-- | Backend/Api/Api/Controllers/AuthController.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Backend/Api/Api/Controllers/AuthController.cs b/Backend/Api/Api/Controllers/AuthController.cs index 456abd9..6727125 100644 --- a/Backend/Api/Api/Controllers/AuthController.cs +++ b/Backend/Api/Api/Controllers/AuthController.cs @@ -33,5 +33,18 @@ namespace Api.Controllers return Ok(); } + [HttpPost("login")] + public async Task<ActionResult<string>> Login([FromBody] Login creds) + { + var id = await _userService.UserIdFromJwt(); + if (id != null) return Forbid(); + + var jwt= await _userService.Login(creds); + if (jwt != null) + { + return Ok(new { token = jwt }); + } + return BadRequest(); + } } } |